- Fixed possible NULL pointer derefs in P_LineAttack()

SVN r4264 (trunk)
This commit is contained in:
Randy Heit 2013-05-13 02:30:55 +00:00
parent 894c4198b0
commit b418f7de8d

View file

@ -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);
}