From 4342e4c0d1638379d91635eadb0c36e38630105e Mon Sep 17 00:00:00 2001 From: "seer-by-sentry[bot]" <157164994+seer-by-sentry[bot]@users.noreply.github.com> Date: Fri, 17 Apr 2026 10:39:32 +0000 Subject: [PATCH] bugfix(gui): Guard against empty selected drawables list access in ControlBar --- .../Source/GameClient/GUI/ControlBar/ControlBar.cpp | 4 +++- .../Source/GameClient/GUI/ControlBar/ControlBar.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index 9d7f4cd7e72..162e3969d20 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -1808,7 +1808,9 @@ void ControlBar::evaluateContextUI() } else // get the first and only drawble in the selection list - drawToEvaluateFor = selectedDrawables->front(); + // TheSuperHackers @fix The first access to this can return an empty list + if (!selectedDrawables->empty()) + drawToEvaluateFor = selectedDrawables->front(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index f07e61c8caf..2c3b3579b65 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -1833,7 +1833,9 @@ void ControlBar::evaluateContextUI() } else // get the first and only drawble in the selection list - drawToEvaluateFor = selectedDrawables->front(); + // TheSuperHackers @fix The first access to this can return an empty list + if (!selectedDrawables->empty()) + drawToEvaluateFor = selectedDrawables->front();