From 1078f68afd53169219d43ba21b2df877f905d2c3 Mon Sep 17 00:00:00 2001 From: "seer-by-sentry[bot]" <157164994+seer-by-sentry[bot]@users.noreply.github.com> Date: Sat, 11 Oct 2025 03:46:01 +0000 Subject: [PATCH] LoadScreen: Add null checks for TheGameEngine, TheWindowManager, TheDisplay, TheNetwork, and TheMouse --- .../Source/GameClient/GUI/LoadScreen.cpp | 27 +++++++++----- .../Source/GameClient/GUI/LoadScreen.cpp | 35 ++++++++++++------- 2 files changed, 40 insertions(+), 22 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp index 6eb6da869ac..16b413b7a23 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp @@ -140,11 +140,16 @@ LoadScreen::~LoadScreen( void ) void LoadScreen::update( Int percent ) { - TheGameEngine->serviceWindowsOS(); - TheWindowManager->update(); - TheDisplay->update(); - // redraw all views, update the GUI - TheDisplay->draw(); + if(TheGameEngine) + TheGameEngine->serviceWindowsOS(); + if(TheWindowManager) + TheWindowManager->update(); + if(TheDisplay) + { + TheDisplay->update(); + // redraw all views, update the GUI + TheDisplay->draw(); + } setFPMode(); } @@ -1190,13 +1195,17 @@ void GameSpyLoadScreen::reset( void ) void GameSpyLoadScreen::update( Int percent ) { - if(percent <= 100) - TheNetwork->updateLoadProgress( percent ); - TheNetwork->liteupdate(); + if(TheNetwork) + { + if(percent <= 100) + TheNetwork->updateLoadProgress( percent ); + TheNetwork->liteupdate(); + } //GadgetProgressBarSetProgress(m_progressBars[TheNetwork->getLocalPlayerID()], percent ); - TheMouse->setCursorTooltip(UnicodeString::TheEmptyString); + if(TheMouse) + TheMouse->setCursorTooltip(UnicodeString::TheEmptyString); // Do this last! LoadScreen::update( percent ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp index e40bfa50f90..246a59f17d2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp @@ -161,14 +161,21 @@ LoadScreen::~LoadScreen( void ) void LoadScreen::update( Int percent ) { - TheGameEngine->serviceWindowsOS(); - if (TheGameEngine->getQuitting()) - return; //don't bother with any of this if the player is exiting game. + if(TheGameEngine) + { + TheGameEngine->serviceWindowsOS(); + if (TheGameEngine->getQuitting()) + return; //don't bother with any of this if the player is exiting game. + } - TheWindowManager->update(); - TheDisplay->update(); - // redraw all views, update the GUI - TheDisplay->draw(); + if(TheWindowManager) + TheWindowManager->update(); + if(TheDisplay) + { + TheDisplay->update(); + // redraw all views, update the GUI + TheDisplay->draw(); + } setFPMode(); } @@ -1855,12 +1862,12 @@ void GameSpyLoadScreen::reset( void ) void GameSpyLoadScreen::update( Int percent ) { - if(percent <= 100) - TheNetwork->updateLoadProgress( percent ); - TheNetwork->liteupdate(); - - if (TheNetwork != nullptr) + if(TheNetwork) { + if(percent <= 100) + TheNetwork->updateLoadProgress( percent ); + TheNetwork->liteupdate(); + if (percent >= 50) { if (!g_bHasDoneSOGScreenshot) @@ -1878,7 +1885,9 @@ void GameSpyLoadScreen::update( Int percent ) { NGMP_OnlineServicesManager::GetInstance()->Tick(); } - TheMouse->setCursorTooltip(UnicodeString::TheEmptyString); + + if(TheMouse) + TheMouse->setCursorTooltip(UnicodeString::TheEmptyString); // Do this last! LoadScreen::update( percent );