Skip to content

Commit a49ce03

Browse files
authored
CPoolsSA: properly handle allocation failure
1 parent f6a37ac commit a49ce03

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Client/game_sa/CPoolsSA.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "CWorldSA.h"
2727

2828
#include "enums/VehicleClass.h"
29+
#include <new>
2930

3031
extern CGameSA* pGame;
3132

@@ -242,7 +243,7 @@ CObject* CPoolsSA::AddObject(CClientObject* pClientObject, DWORD dwModelID, bool
242243

243244
if (m_objectPool.ulCount < MAX_OBJECTS)
244245
{
245-
pObject = new CObjectSA(dwModelID, bBreakingDisabled);
246+
pObject = new (std::nothrow) CObjectSA(dwModelID, bBreakingDisabled);
246247

247248
if (pObject && AddObjectToPool(pClientObject, pObject))
248249
{

0 commit comments

Comments
 (0)