From 5007571732e2c1dba0c37636e13bcfc9c378af25 Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Mon, 20 May 2013 20:47:55 +0000 Subject: [PATCH] - Fixed: Possible NULL deref in P_RailAttack. SVN r4274 (trunk) --- src/p_map.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index 224719509..b9cbf3f37 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -4071,24 +4071,21 @@ void P_RailAttack (AActor *source, int damage, int offset_xy, fixed_t offset_z, } } - if (trace.HitType == TRACE_HitFloor && - trace.CrossedWater == NULL && - trace.Sector->heightsec == NULL) + if(thepuff != NULL) { - if (thepuff != NULL) + if (trace.HitType == TRACE_HitFloor && + trace.CrossedWater == NULL && + trace.Sector->heightsec == NULL) { thepuff->SetOrigin(trace.X, trace.Y, trace.Z); P_HitWater (thepuff, trace.Sector); } - } - if (trace.Crossed3DWater || trace.CrossedWater) - { - if (thepuff != NULL) + if (trace.Crossed3DWater || trace.CrossedWater) { SpawnDeepSplash (source, trace, thepuff, vx, vy, vz, shootz, trace.Crossed3DWater != NULL); } + thepuff->Destroy (); } - thepuff->Destroy (); // Draw the slug's trail. end.X = FIXED2FLOAT(trace.X);