From 8f0280719b708f0ba5aba3a5103f8b7682ab2c3c Mon Sep 17 00:00:00 2001 From: "seer-by-sentry[bot]" <157164994+seer-by-sentry[bot]@users.noreply.github.com> Date: Fri, 10 Oct 2025 18:57:06 +0000 Subject: [PATCH] Fix: Check for null TheDownloadManager before using it --- .../GeneralsOnline/OnlineServices_Init.cpp | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GeneralsOnline/OnlineServices_Init.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GeneralsOnline/OnlineServices_Init.cpp index 8ea62e162f2..5e3ee60938f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GeneralsOnline/OnlineServices_Init.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GeneralsOnline/OnlineServices_Init.cpp @@ -326,8 +326,11 @@ void NGMP_OnlineServicesManager::ContinueUpdate() uint32_t downloadSize = m_vecFilesSizes.front(); m_vecFilesSizes.pop(); - TheDownloadManager->SetFileName(AsciiString(strDownloadPath.c_str())); - TheDownloadManager->OnStatusUpdate(DOWNLOADSTATUS_DOWNLOADING); + if (TheDownloadManager != nullptr) + { + TheDownloadManager->SetFileName(AsciiString(strDownloadPath.c_str())); + TheDownloadManager->OnStatusUpdate(DOWNLOADSTATUS_DOWNLOADING); + } // this isnt a super nice way of doing this, lets make a download manager std::map mapHeaders; @@ -346,7 +349,10 @@ void NGMP_OnlineServicesManager::ContinueUpdate() else { // set done - TheDownloadManager->OnProgressUpdate(downloadSize, downloadSize, 0, 0); + if (TheDownloadManager != nullptr) + { + TheDownloadManager->OnProgressUpdate(downloadSize, downloadSize, 0, 0); + } m_vecFilesDownloaded.push_back(strDownloadPath); @@ -378,14 +384,20 @@ void NGMP_OnlineServicesManager::ContinueUpdate() { //m_bytesReceivedSoFar += bytesReceived; - TheDownloadManager->OnProgressUpdate(bytesReceived, downloadSize, -1, -1); + if (TheDownloadManager != nullptr) + { + TheDownloadManager->OnProgressUpdate(bytesReceived, downloadSize, -1, -1); + } } ); } else if (m_vecFilesToDownload.size() == 0 && m_vecFilesDownloaded.size() > 0) // nothing left but we did download something { - TheDownloadManager->SetFileName("Update is complete!"); - TheDownloadManager->OnStatusUpdate(DOWNLOADSTATUS_FINISHING); + if (TheDownloadManager != nullptr) + { + TheDownloadManager->SetFileName("Update is complete!"); + TheDownloadManager->OnStatusUpdate(DOWNLOADSTATUS_FINISHING); + } m_updateCompleteCallback(); }