diff --git a/src/playsim/p_mobj.cpp b/src/playsim/p_mobj.cpp index a2fc66faa6..9f64cd9865 100644 --- a/src/playsim/p_mobj.cpp +++ b/src/playsim/p_mobj.cpp @@ -7359,14 +7359,15 @@ void AActor::ClearCounters() int AActor::GetModifiedDamage(FName damagetype, int damage, bool passive, AActor *inflictor, AActor *source, int flags) { auto inv = Inventory; - while (inv != nullptr) + while (inv != nullptr && !(inv->ObjectFlags & OF_EuthanizeMe)) { + auto nextinv = inv->Inventory; IFVIRTUALPTRNAME(inv, NAME_Inventory, ModifyDamage) { VMValue params[8] = { (DObject*)inv, damage, damagetype.GetIndex(), &damage, passive, inflictor, source, flags }; VMCall(func, params, 8, nullptr, 0); } - inv = inv->Inventory; + inv = nextinv; } return damage; }