Skip to content

Commit

Permalink
Restore "this == NULL" checks for CNetworkLibrary methods.
Browse files Browse the repository at this point in the history
- Delete CNetworkLibrary class after CInput, CSoundLibrary and CGfxLibrary.
  • Loading branch information
DreamyCecil committed Oct 28, 2023
1 parent dc7d2c9 commit 30150ce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Sources/Engine/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions Sources/Engine/Network/Network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 30150ce

Please sign in to comment.