mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- 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:
parent
26a15d0ccc
commit
2afadb0108
1 changed files with 15 additions and 8 deletions
|
@ -3123,22 +3123,29 @@ bool ADehackedPickup::TryPickup (AActor *&toucher)
|
|||
|
||||
const char *ADehackedPickup::PickupMessage ()
|
||||
{
|
||||
return RealPickup->PickupMessage ();
|
||||
if (RealPickup != nullptr)
|
||||
return RealPickup->PickupMessage ();
|
||||
else return "";
|
||||
}
|
||||
|
||||
bool ADehackedPickup::ShouldStay ()
|
||||
{
|
||||
return RealPickup->ShouldStay ();
|
||||
if (RealPickup != nullptr)
|
||||
return RealPickup->ShouldStay ();
|
||||
else return true;
|
||||
}
|
||||
|
||||
bool ADehackedPickup::ShouldRespawn ()
|
||||
{
|
||||
return RealPickup->ShouldRespawn ();
|
||||
if (RealPickup != nullptr)
|
||||
return RealPickup->ShouldRespawn ();
|
||||
else return false;
|
||||
}
|
||||
|
||||
void ADehackedPickup::PlayPickupSound (AActor *toucher)
|
||||
{
|
||||
RealPickup->PlayPickupSound (toucher);
|
||||
if (RealPickup != nullptr)
|
||||
RealPickup->PlayPickupSound (toucher);
|
||||
}
|
||||
|
||||
void ADehackedPickup::DoPickupSpecial (AActor *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 ();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue