From b077518c89804cf317429132cdadece783a5c2d7 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 13 Aug 2017 16:15:31 +0300 Subject: [PATCH] Fixed crash when morph item is used from ACS https://forum.zdoom.org/viewtopic.php?t=57571 --- src/p_acs.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 37aef6fad..5b146f2d1 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -1843,7 +1843,9 @@ static bool DoUseInv (AActor *actor, PClassActor *info) AInventory *item = actor->FindInventory (info); if (item != NULL) { - if (actor->player == NULL) + player_t* const player = actor->player; + + if (nullptr == player) { return actor->UseInventory(item); } @@ -1853,10 +1855,10 @@ static bool DoUseInv (AActor *actor, PClassActor *info) bool res; // Bypass CF_TOTALLYFROZEN - cheats = actor->player->cheats; - actor->player->cheats &= ~CF_TOTALLYFROZEN; + cheats = player->cheats; + player->cheats &= ~CF_TOTALLYFROZEN; res = actor->UseInventory(item); - actor->player->cheats |= (cheats & CF_TOTALLYFROZEN); + player->cheats |= (cheats & CF_TOTALLYFROZEN); return res; } }