Fix a potential crash vector in the shadows code. (It DEFINITELY crashed when I was testing the thunder shield, for example.)

This commit is contained in:
toaster 2018-09-13 20:41:12 +01:00
parent 57d333b6b5
commit ccc615e9b1

View file

@ -6283,8 +6283,11 @@ void P_RunShadows(void)
next = mobj->hnext;
P_SetTarget(&mobj->hnext, NULL);
if (!mobj->target)
if (!mobj->target || P_MobjWasRemoved(mobj->target))
{
mobj->flags2 |= MF2_DONTDRAW;
continue; // shouldn't you already be dead?
}
if ((mobj->target->flags2 & MF2_DONTDRAW)
|| (((mobj->target->eflags & MFE_VERTICALFLIP) && mobj->target->z+mobj->target->height > mobj->target->ceilingz)