Fixed crash when morph item is used from ACS

https://forum.zdoom.org/viewtopic.php?t=57571
This commit is contained in:
alexey.lysiuk 2017-08-13 16:15:31 +03:00
parent a6d4bfc748
commit b077518c89

View file

@ -1843,7 +1843,9 @@ static bool DoUseInv (AActor *actor, PClassActor *info)
AInventory *item = actor->FindInventory (info); AInventory *item = actor->FindInventory (info);
if (item != NULL) if (item != NULL)
{ {
if (actor->player == NULL) player_t* const player = actor->player;
if (nullptr == player)
{ {
return actor->UseInventory(item); return actor->UseInventory(item);
} }
@ -1853,10 +1855,10 @@ static bool DoUseInv (AActor *actor, PClassActor *info)
bool res; bool res;
// Bypass CF_TOTALLYFROZEN // Bypass CF_TOTALLYFROZEN
cheats = actor->player->cheats; cheats = player->cheats;
actor->player->cheats &= ~CF_TOTALLYFROZEN; player->cheats &= ~CF_TOTALLYFROZEN;
res = actor->UseInventory(item); res = actor->UseInventory(item);
actor->player->cheats |= (cheats & CF_TOTALLYFROZEN); player->cheats |= (cheats & CF_TOTALLYFROZEN);
return res; return res;
} }
} }