Fix crash accessing removed banana chain

This commit is contained in:
AJ Martinez 2024-03-30 20:07:26 -07:00
parent 193c85a418
commit 604c69050e

View file

@ -1752,7 +1752,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
{ {
if (target->movedir != 0 && target->movedir < (UINT16)target->target->player->itemamount) if (target->movedir != 0 && target->movedir < (UINT16)target->target->player->itemamount)
{ {
if (target->target->hnext) if (target->target->hnext && !P_MobjWasRemoved(target->target->hnext))
K_KillBananaChain(target->target->hnext, inflictor, source); K_KillBananaChain(target->target->hnext, inflictor, source);
target->target->player->itemamount = 0; target->target->player->itemamount = 0;
} }