From 66a2cdb6e9a903dbacf9451a3728e302e9fd31d7 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 20 Dec 2018 22:09:08 +0100 Subject: [PATCH] - added missing null pointer checks to cheat code. --- src/m_cheat.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/m_cheat.cpp b/src/m_cheat.cpp index 2263a0dfe..acb88294b 100644 --- a/src/m_cheat.cpp +++ b/src/m_cheat.cpp @@ -549,6 +549,7 @@ FString cht_Morph(player_t *player, PClassActor *morphclass, bool quickundo) void cht_SetInv(player_t *player, const char *string, int amount, bool beyond) { + if (!player->mo) return; IFVIRTUALPTR(player->mo, APlayerPawn, CheatTakeInv) { FString message = string; @@ -559,6 +560,7 @@ void cht_SetInv(player_t *player, const char *string, int amount, bool beyond) void cht_Give (player_t *player, const char *name, int amount) { + if (!player->mo) return; IFVIRTUALPTR(player->mo, APlayerPawn, CheatGive) { FString namestr = name; @@ -569,6 +571,7 @@ void cht_Give (player_t *player, const char *name, int amount) void cht_Take (player_t *player, const char *name, int amount) { + if (!player->mo) return; IFVIRTUALPTR(player->mo, APlayerPawn, CheatTake) { FString namestr = name; @@ -579,6 +582,7 @@ void cht_Take (player_t *player, const char *name, int amount) void cht_Takeweaps(player_t *player) { + if (!player->mo) return; IFVIRTUALPTR(player->mo, APlayerPawn, CheatTakeWeaps) { VMValue params[3] = { player->mo };