From 87dbfb68e9de2f6eefea71aa85988b2ab139f713 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 19 Feb 2013 01:51:07 +0000 Subject: [PATCH] - Fixed: PCD_MORPHACTOR and P_MorphMonster() needed NULL pointer checks. SVN r4141 (trunk) --- src/g_shared/a_morph.cpp | 2 +- src/p_acs.cpp | 23 ++++++----------------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/g_shared/a_morph.cpp b/src/g_shared/a_morph.cpp index 862baa30b..0058c996b 100644 --- a/src/g_shared/a_morph.cpp +++ b/src/g_shared/a_morph.cpp @@ -366,7 +366,7 @@ bool P_MorphMonster (AActor *actor, const PClass *spawntype, int duration, int s { AMorphedMonster *morphed; - if (actor->player || spawntype == NULL || + if (actor == NULL || actor->player || spawntype == NULL || actor->flags3 & MF3_DONTMORPH || !(actor->flags3 & MF3_ISMONSTER) || !spawntype->IsDescendantOf (RUNTIME_CLASS(AMorphedMonster))) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 3e4f349dc..1527ba849 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -7175,19 +7175,13 @@ scriptwait: if (tag == 0) { - if (activator->player) + if (activator != NULL && activator->player) { - if (P_MorphPlayer(activator->player, activator->player, playerclass, duration, style, morphflash, unmorphflash)) - { - changes++; - } + changes += P_MorphPlayer(activator->player, activator->player, playerclass, duration, style, morphflash, unmorphflash); } else { - if (P_MorphMonster(activator, monsterclass, duration, style, morphflash, unmorphflash)) - { - changes++; - } + changes += P_MorphMonster(activator, monsterclass, duration, style, morphflash, unmorphflash); } } else @@ -7199,17 +7193,12 @@ scriptwait: { if (actor->player) { - if (P_MorphPlayer(activator->player, actor->player, playerclass, duration, style, morphflash, unmorphflash)) - { - changes++; - } + changes += P_MorphPlayer(activator == NULL ? NULL : activator->player, + actor->player, playerclass, duration, style, morphflash, unmorphflash); } else { - if (P_MorphMonster(actor, monsterclass, duration, style, morphflash, unmorphflash)) - { - changes++; - } + changes += P_MorphMonster(actor, monsterclass, duration, style, morphflash, unmorphflash); } } }