From f2a457206ce1b3684c2367b2235216bffd2ca953 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 30 Aug 2011 15:34:40 +0000 Subject: [PATCH] - fixed some potential NULL pointer accesses. SVN r3285 (trunk) --- src/g_doom/a_bossbrain.cpp | 2 +- src/g_doom/a_doomweaps.cpp | 2 +- src/g_hexen/a_hexenspecialdecs.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/g_doom/a_bossbrain.cpp b/src/g_doom/a_bossbrain.cpp index d0fb03cbcc..f7bc68080f 100644 --- a/src/g_doom/a_bossbrain.cpp +++ b/src/g_doom/a_bossbrain.cpp @@ -120,10 +120,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BrainSpit) // Boss cubes should move freely to their destination so it's // probably best to disable all collision detection for them. - if (spit->flags & MF_NOCLIP) spit->flags5 |= MF5_NOINTERACTION; if (spit != NULL) { + if (spit->flags & MF_NOCLIP) spit->flags5 |= MF5_NOINTERACTION; spit->target = targ; spit->master = self; // [RH] Do this correctly for any trajectory. Doom would divide by 0 diff --git a/src/g_doom/a_doomweaps.cpp b/src/g_doom/a_doomweaps.cpp index f5bf1a8004..23496b99b0 100644 --- a/src/g_doom/a_doomweaps.cpp +++ b/src/g_doom/a_doomweaps.cpp @@ -586,7 +586,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray) damage += (pr_bfgspray() & 7) + 1; thingToHit = linetarget; - P_DamageMobj (thingToHit, self->target, self->target, damage, spray->DamageType); + P_DamageMobj (thingToHit, self->target, self->target, damage, spray != NULL? FName(spray->DamageType) : FName(NAME_BFGSplash)); P_TraceBleed (damage, thingToHit, self->target); } } diff --git a/src/g_hexen/a_hexenspecialdecs.cpp b/src/g_hexen/a_hexenspecialdecs.cpp index 9c1fc398db..afca4f190e 100644 --- a/src/g_hexen/a_hexenspecialdecs.cpp +++ b/src/g_hexen/a_hexenspecialdecs.cpp @@ -61,9 +61,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_PotteryExplode) for(i = (pr_pottery()&3)+3; i; i--) { mo = Spawn ("PotteryBit", self->x, self->y, self->z, ALLOW_REPLACE); - mo->SetState (mo->SpawnState + (pr_pottery()%5)); if (mo) { + mo->SetState (mo->SpawnState + (pr_pottery()%5)); mo->velz = ((pr_pottery()&7)+5)*(3*FRACUNIT/4); mo->velx = (pr_pottery.Random2())<<(FRACBITS-6); mo->vely = (pr_pottery.Random2())<<(FRACBITS-6);