diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index 39c8170e1d..199340551a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -1737,7 +1737,12 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Object *beacon = findObjectByID(*it); if (beacon) { - const ThingTemplate *thing = TheThingFactory->findTemplate( beacon->getControllingPlayer()->getPlayerTemplate()->getBeaconTemplate() ); + // TheSuperHackers @bugfix Prevent runtime crashing when a beacon is no longer associated with an initialized player. + const PlayerTemplate *playerTemplate = beacon->getControllingPlayer()->getPlayerTemplate(); + if (!playerTemplate) + continue; + + const ThingTemplate *thing = TheThingFactory->findTemplate( playerTemplate->getBeaconTemplate() ); if (thing && thing->isEquivalentTo(beacon->getTemplate())) { if (beacon->getControllingPlayer() == thisPlayer) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index 0223084c48..da06881d2d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -1765,7 +1765,12 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Object *beacon = findObjectByID(*it); if (beacon) { - const ThingTemplate *thing = TheThingFactory->findTemplate( beacon->getControllingPlayer()->getPlayerTemplate()->getBeaconTemplate() ); + // TheSuperHackers @bugfix Prevent runtime crashing when a beacon is no longer associated with an initialized player. + const PlayerTemplate *playerTemplate = beacon->getControllingPlayer()->getPlayerTemplate(); + if (!playerTemplate) + continue; + + const ThingTemplate *thing = TheThingFactory->findTemplate( playerTemplate->getBeaconTemplate() ); if (thing && thing->isEquivalentTo(beacon->getTemplate())) { if (beacon->getControllingPlayer() == thisPlayer)