From d398b1101f42a695615c825d2b4d627fc4643695 Mon Sep 17 00:00:00 2001 From: "seer-by-sentry[bot]" <157164994+seer-by-sentry[bot]@users.noreply.github.com> Date: Sun, 25 Jan 2026 16:16:29 +0000 Subject: [PATCH] Prevent null command button assignment from control bar override --- .../Code/GameEngine/Source/GameLogic/System/GameLogic.cpp | 4 ++-- .../Code/GameEngine/Source/GameLogic/System/GameLogic.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index 9864608af0..b1675376f2 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -3973,9 +3973,9 @@ Bool GameLogic::findControlBarOverride(const AsciiString& commandSetName, Int sl strcpy(&buf[1], commandSetName.str()); ControlBarOverrideMap::const_iterator it = m_controlBarOverrides.find(buf); - if (it != m_controlBarOverrides.end()) + if (it != m_controlBarOverrides.end() && it->second != nullptr) { - commandButton = it->second; // could be null. + commandButton = it->second; return true; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index bfd91242f0..75703cfa71 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -4743,9 +4743,9 @@ Bool GameLogic::findControlBarOverride(const AsciiString& commandSetName, Int sl strcpy(&buf[1], commandSetName.str()); ControlBarOverrideMap::const_iterator it = m_controlBarOverrides.find(buf); - if (it != m_controlBarOverrides.end()) + if (it != m_controlBarOverrides.end() && it->second != nullptr) { - commandButton = it->second; // could be null. + commandButton = it->second; return true; }