From b418f7de8d011b8e632143df3e7782f1a3b399f3 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Mon, 13 May 2013 02:30:55 +0000 Subject: [PATCH] - Fixed possible NULL pointer derefs in P_LineAttack() SVN r4264 (trunk) --- src/p_map.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index 7a1da4d1e4..2247195090 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -3546,9 +3546,10 @@ AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, (t1->player->ReadyWeapon->flags2 & MF2_THRUGHOST)) || (puffDefaults && (puffDefaults->flags2 & MF2_THRUGHOST)); - // if the puff uses a non-standard damage type this will override default, hitscan and melee damage type. + // if the puff uses a non-standard damage type, this will override default, hitscan and melee damage type. // All other explicitly passed damage types (currenty only MDK) will be preserved. - if ((damageType == NAME_None || damageType == NAME_Melee || damageType == NAME_Hitscan) && puffDefaults->DamageType != NAME_None) + if ((damageType == NAME_None || damageType == NAME_Melee || damageType == NAME_Hitscan) && + puffDefaults != NULL && puffDefaults->DamageType != NAME_None) { damageType = puffDefaults->DamageType; } @@ -3568,7 +3569,7 @@ AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, { // Play miss sound S_Sound (t1, CHAN_WEAPON, puffDefaults->ActiveSound, 1, ATTN_NORM); } - if (puffDefaults->flags3 & MF3_ALWAYSPUFF) + if (puffDefaults != NULL && puffDefaults->flags3 & MF3_ALWAYSPUFF) { // Spawn the puff anyway puff = P_SpawnPuff (t1, pufftype, trace.X, trace.Y, trace.Z, angle - ANG180, 2, puffFlags); }