From 80442db4fe12b7742184db62b80771d67c01644c Mon Sep 17 00:00:00 2001 From: drfrag Date: Tue, 15 Oct 2019 14:45:52 +0200 Subject: [PATCH] - Yet even more missing null pointer checks, PB still crashed. --- src/p_mobj.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 90b353e46..b2c5fd9fa 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -5711,6 +5711,8 @@ void P_SpawnBlood (const DVector3 &pos1, DAngle dir, int damage, AActor *origina if (bloodcls != NULL) { th = Spawn(bloodcls, pos, NO_REPLACE); // GetBloodType already performed the replacement + + if (th == nullptr) return; th->Vel.Z = 2; th->Angles.Yaw = dir; // [NG] Applying PUFFGETSOWNER to the blood will make it target the owner @@ -5818,6 +5820,8 @@ void P_BloodSplatter (const DVector3 &pos, AActor *originator, DAngle hitangle) AActor *mo; mo = Spawn(bloodcls, pos, NO_REPLACE); // GetBloodType already performed the replacement + + if (mo == nullptr) return; mo->target = originator; mo->Vel.X = pr_splatter.Random2 () / 64.; mo->Vel.Y = pr_splatter.Random2() / 64.; @@ -5862,6 +5866,8 @@ void P_BloodSplatter2 (const DVector3 &pos, AActor *originator, DAngle hitangle) mo = Spawn (bloodcls, pos + add, NO_REPLACE); // GetBloodType already performed the replacement + + if (mo == nullptr) return; mo->target = originator; // colorize the blood! @@ -5916,6 +5922,8 @@ void P_RipperBlood (AActor *mo, AActor *bleeder) { AActor *th; th = Spawn (bloodcls, pos, NO_REPLACE); // GetBloodType already performed the replacement + + if (th == nullptr) return; // [NG] Applying PUFFGETSOWNER to the blood will make it target the owner if (th->flags5 & MF5_PUFFGETSOWNER) th->target = bleeder; if (gameinfo.gametype == GAME_Heretic) @@ -6624,7 +6632,7 @@ AActor *P_SpawnSubMissile(AActor *source, PClassActor *type, AActor *target) { AActor *other = Spawn(type, source->Pos(), ALLOW_REPLACE); - if (source == nullptr || type == nullptr) + if (other == nullptr || source == nullptr || type == nullptr) { return nullptr; }