Fix segfault when removing source from ShouldDamage

This commit is contained in:
Gustaf Alhäll 2023-04-18 20:46:13 +02:00
parent 57b0dfcfac
commit 072dd2eda7
No known key found for this signature in database
GPG key ID: 6C1F67D690CDEDFD

View file

@ -3546,6 +3546,8 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
UINT8 shouldForce = LUA_HookShouldDamage(target, inflictor, source, damage, damagetype);
if (P_MobjWasRemoved(target))
return (shouldForce == 1); // mobj was removed
if (P_MobjWasRemoved(source))
source = NULL;
if (shouldForce == 1)
force = true;
else if (shouldForce == 2)