- fixed: ADehackedPickup was missing NULL pointer checks in nearly all methods that used RealPickup.

Some DECORATE hacks make it possible that this does not contain a valid pointer when these methods are called.
This commit is contained in:
Christoph Oelckers 2016-06-01 23:41:34 +02:00
parent 26a15d0ccc
commit 2afadb0108

View file

@ -3123,21 +3123,28 @@ bool ADehackedPickup::TryPickup (AActor *&toucher)
const char *ADehackedPickup::PickupMessage ()
{
if (RealPickup != nullptr)
return RealPickup->PickupMessage ();
else return "";
}
bool ADehackedPickup::ShouldStay ()
{
if (RealPickup != nullptr)
return RealPickup->ShouldStay ();
else return true;
}
bool ADehackedPickup::ShouldRespawn ()
{
if (RealPickup != nullptr)
return RealPickup->ShouldRespawn ();
else return false;
}
void ADehackedPickup::PlayPickupSound (AActor *toucher)
{
if (RealPickup != nullptr)
RealPickup->PlayPickupSound (toucher);
}
@ -3146,19 +3153,19 @@ void ADehackedPickup::DoPickupSpecial (AActor *toucher)
Super::DoPickupSpecial (toucher);
// If the real pickup hasn't joined the toucher's inventory, make sure it
// doesn't stick around.
if (RealPickup->Owner != toucher)
if (RealPickup != nullptr && RealPickup->Owner != toucher)
{
RealPickup->Destroy ();
}
RealPickup = NULL;
RealPickup = nullptr;
}
void ADehackedPickup::Destroy ()
{
if (RealPickup != NULL)
if (RealPickup != nullptr)
{
RealPickup->Destroy ();
RealPickup = NULL;
RealPickup = nullptr;
}
Super::Destroy ();
}