Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

fix(gameengine): skip a missing window in ControlBar::placeWindowAt

Olcay Seygan2dfc710ccdb5
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
index 42db35f6c..fcf7de572 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
@@ -2201,6 +2201,9 @@ Int ControlBar::getPanelSlideOffset( Int panel ) const
//-------------------------------------------------------------------------------------------------
void ControlBar::placeWindowAt( GameWindow *window, const IRegion2D &rect )
{
+ // a layout without the named window (a modded ControlBar.wnd, a panel not built yet) hands in null
+ if( window == nullptr )
+ return;
ICoord2D screen, size;
window->winGetScreenPosition( &screen.x, &screen.y );
window->winGetSize( &size.x, &size.y );