From 8cfe0649c405970490f5e50d0e7e0432a2b1713b Mon Sep 17 00:00:00 2001 From: "seer-by-sentry[bot]" <157164994+seer-by-sentry[bot]@users.noreply.github.com> Date: Mon, 16 Mar 2026 00:17:30 +0000 Subject: [PATCH] Fix: Guard against null controlling player in Team relationship --- Generals/Code/GameEngine/Source/Common/RTS/Team.cpp | 6 +++++- GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp index 8dd327575c0..21ea6e371e5 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp @@ -1492,7 +1492,11 @@ Relationship Team::getRelationship(const Team *that) const } // nope -- go with our Player's view on the matter. - return getControllingPlayer()->getRelationship(that); + // TheSuperHackers @bugfix Mauller 16/03/2026 Guard against null controlling player to prevent access violation + const Player* controllingPlayer = getControllingPlayer(); + if (controllingPlayer == nullptr) + return NEUTRAL; + return controllingPlayer->getRelationship(that); } // ------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp index 7d28fc8d62b..4bc112feabe 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp @@ -1493,7 +1493,11 @@ Relationship Team::getRelationship(const Team *that) const } // nope -- go with our Player's view on the matter. - return getControllingPlayer()->getRelationship(that); + // TheSuperHackers @bugfix Mauller 16/03/2026 Guard against null controlling player to prevent access violation + const Player* controllingPlayer = getControllingPlayer(); + if (controllingPlayer == nullptr) + return NEUTRAL; + return controllingPlayer->getRelationship(that); } // ------------------------------------------------------------------------