Skip to content

Commit 597409f

Browse files
NGMP: Add null check for pCurrentGame before accessing its slots
1 parent 1624e67 commit 597409f

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

GeneralsMD/Code/GameEngine/Source/GameNetwork/GeneralsOnline/NextGenTransport.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,13 @@ Bool NextGenTransport::doSend(void)
190190
return FALSE;
191191
}
192192

193-
NGMPGameSlot* pSlot = (NGMPGameSlot*)pLobbyInterface->GetCurrentGame()->getSlot(m_outBuffer[i].addr);
193+
NGMPGame* pCurrentGame = pLobbyInterface->GetCurrentGame();
194+
if (pCurrentGame == nullptr)
195+
{
196+
return FALSE;
197+
}
198+
199+
NGMPGameSlot* pSlot = (NGMPGameSlot*)pCurrentGame->getSlot(m_outBuffer[i].addr);
194200

195201
if (pSlot != nullptr)
196202
{
@@ -269,4 +275,4 @@ Bool NextGenTransport::queueSend(UnsignedInt addr, UnsignedShort port, const Uns
269275
}
270276
}
271277
return false;
272-
}
278+
}

0 commit comments

Comments
 (0)