mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 04:51:19 +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,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 ();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue