From 79d69db2d12cb63fd690ebac435502154187daba Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Fri, 18 Jul 2025 14:46:30 +0200 Subject: [PATCH 1/3] Refactored checks. --- .../Source/GameLogic/System/GameLogicDispatch.cpp | 7 ++++++- .../Source/GameLogic/System/GameLogicDispatch.cpp | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index 39c8170e1d..2425716ee6 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() ); + // sometimes beacons are not associated with any player (anymore) + 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..c2ee03ecae 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() ); + // sometimes beacons are not associated with any player (anymore) + 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) From c0407357b5e32fbcd026a4caf46b527028787967 Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Fri, 18 Jul 2025 23:30:27 +0200 Subject: [PATCH 2/3] Updated comments. --- .../GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp | 2 +- .../GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index 2425716ee6..4842472ec0 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -1737,7 +1737,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Object *beacon = findObjectByID(*it); if (beacon) { - // sometimes beacons are not associated with any player (anymore) + // TheSuperHackers @bugfix Prevent runtime crashing when a beacon is no longer associated with a player. const PlayerTemplate *playerTemplate = beacon->getControllingPlayer()->getPlayerTemplate(); if (!playerTemplate) continue; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index c2ee03ecae..825fc49a48 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -1765,7 +1765,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Object *beacon = findObjectByID(*it); if (beacon) { - // sometimes beacons are not associated with any player (anymore) + // TheSuperHackers @bugfix Prevent runtime crashing when a beacon is no longer associated with a player. const PlayerTemplate *playerTemplate = beacon->getControllingPlayer()->getPlayerTemplate(); if (!playerTemplate) continue; From a9ce9e0360c9b94066e742f618e4929a0d506fa2 Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Sun, 20 Jul 2025 14:08:53 +0200 Subject: [PATCH 3/3] Tweaked comment. --- .../GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp | 2 +- .../GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index 4842472ec0..199340551a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -1737,7 +1737,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Object *beacon = findObjectByID(*it); if (beacon) { - // TheSuperHackers @bugfix Prevent runtime crashing when a beacon is no longer associated with a player. + // 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; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index 825fc49a48..da06881d2d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -1765,7 +1765,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Object *beacon = findObjectByID(*it); if (beacon) { - // TheSuperHackers @bugfix Prevent runtime crashing when a beacon is no longer associated with a player. + // 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;