From b8e1bead0a9d36f389041deba15f03ef0b2a10e4 Mon Sep 17 00:00:00 2001 From: Leonard2 Date: Sat, 18 Jun 2016 09:38:22 +0200 Subject: [PATCH] Removed unneeded checks GetPSprite cannot return a null pointer and calling setstate with a null pointer destroys it --- src/g_strife/a_strifestuff.cpp | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/g_strife/a_strifestuff.cpp b/src/g_strife/a_strifestuff.cpp index 4e49121fac..8f571328b6 100644 --- a/src/g_strife/a_strifestuff.cpp +++ b/src/g_strife/a_strifestuff.cpp @@ -352,22 +352,15 @@ DEFINE_ACTION_FUNCTION(AActor, A_ItBurnsItBurns) if (self->player != nullptr && self->player->mo == self) { - FState *firehands = self->FindState("FireHands"); - if (firehands != NULL) - { - DPSprite *psp = self->player->GetPSprite(PSP_STRIFEHANDS); - if (psp != nullptr) - { - psp->SetState(firehands); - psp->Flags &= PSPF_ADDWEAPON | PSPF_ADDBOB; - psp->y = WEAPONTOP; - } + DPSprite *psp = self->player->GetPSprite(PSP_STRIFEHANDS); + psp->Flags &= PSPF_ADDWEAPON | PSPF_ADDBOB; + psp->y = WEAPONTOP; + psp->SetState(self->FindState("FireHands")); - self->player->ReadyWeapon = nullptr; - self->player->PendingWeapon = WP_NOCHANGE; - self->player->playerstate = PST_LIVE; - self->player->extralight = 3; - } + self->player->ReadyWeapon = nullptr; + self->player->PendingWeapon = WP_NOCHANGE; + self->player->playerstate = PST_LIVE; + self->player->extralight = 3; } return 0; }