From 30150ce340113f84e39eec2ee4fe0c01f8af3bcc Mon Sep 17 00:00:00 2001 From: Dreamy Cecil <21009796+DreamyCecil@users.noreply.github.com> Date: Sat, 28 Oct 2023 17:13:21 +0300 Subject: [PATCH] Restore "this == NULL" checks for CNetworkLibrary methods. - Delete CNetworkLibrary class after CInput, CSoundLibrary and CGfxLibrary. --- Sources/Engine/Engine.cpp | 2 +- Sources/Engine/Network/Network.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Sources/Engine/Engine.cpp b/Sources/Engine/Engine.cpp index c11a2fe47..8698bc8fb 100644 --- a/Sources/Engine/Engine.cpp +++ b/Sources/Engine/Engine.cpp @@ -530,10 +530,10 @@ ENGINE_API void SE_EndEngine(void) CRCT_Clear(); // shutdown - if( _pNetwork != NULL) { delete _pNetwork; _pNetwork=NULL; } delete _pInput; _pInput = NULL; delete _pSound; _pSound = NULL; delete _pGfx; _pGfx = NULL; + if (_pNetwork != NULL) { delete _pNetwork; _pNetwork = NULL; } delete _pTimer; _pTimer = NULL; delete _pShell; _pShell = NULL; delete _pConsole; _pConsole = NULL; diff --git a/Sources/Engine/Network/Network.cpp b/Sources/Engine/Network/Network.cpp index b202734fe..1e30068a6 100644 --- a/Sources/Engine/Network/Network.cpp +++ b/Sources/Engine/Network/Network.cpp @@ -656,7 +656,7 @@ extern void FreeUnusedStock(void) */ void CNetworkTimerHandler::HandleTimer(void) { - if (_bTempNetwork) { + if (this==NULL || _bTempNetwork) { return; // this can happen during NET_MakeDefaultState_t()! } // enable stream handling during timer @@ -896,7 +896,7 @@ void CNetworkLibrary::Init(const CTString &strGameID) */ void CNetworkLibrary::AddTimerHandler(void) { - if (_bTempNetwork) { + if (this==NULL || _bTempNetwork) { return; // this can happen during NET_MakeDefaultState_t()! } _pTimer->AddHandler(&ga_thTimerHandler); @@ -906,7 +906,7 @@ void CNetworkLibrary::AddTimerHandler(void) */ void CNetworkLibrary::RemoveTimerHandler(void) { - if (_bTempNetwork) { + if (this==NULL || _bTempNetwork) { return; // this can happen during NET_MakeDefaultState_t()! } _pTimer->RemHandler(&ga_thTimerHandler); @@ -1384,7 +1384,7 @@ void CNetworkLibrary::TogglePause(void) // test if game is paused BOOL CNetworkLibrary::IsPaused(void) { - if (_bTempNetwork) { + if (this==NULL || _bTempNetwork) { return TRUE; // this can happen during NET_MakeDefaultState_t()! } return ga_sesSessionState.ses_bPause; @@ -1421,7 +1421,7 @@ void CNetworkLibrary::SetLocalPause(BOOL bPause) BOOL CNetworkLibrary::GetLocalPause(void) { - if (_bTempNetwork) { + if (this==NULL || _bTempNetwork) { return TRUE; // this can happen during NET_MakeDefaultState_t()! } return ga_bLocalPause; @@ -2027,7 +2027,7 @@ void CNetworkLibrary::SendActionsToServer(void) */ void CNetworkLibrary::TimerLoop(void) { - if (_bTempNetwork) { + if (this==NULL || _bTempNetwork) { return; // this can happen during NET_MakeDefaultState_t()! } _pfNetworkProfile.StartTimer(CNetworkProfile::PTI_TIMERLOOP);