Skip to content

Commit

Permalink
Fix possible crash
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNormalnij committed Feb 2, 2025
1 parent 4916167 commit fbaff85
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Client/mods/deathmatch/logic/CClientBuildingManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ class CClientBuildingManager

private:
bool DoPoolResize(size_t newCapacity);
void AddToList(CClientBuilding* pBuilding) { m_List.push_back(pBuilding); }
void AddToList(CClientBuilding* pBuilding)
{
ResizePoolIfNeeds();
m_List.push_back(pBuilding);
}
void RemoveFromList(CClientBuilding* pBuilding);

std::list<CClientBuilding*> m_List;
Expand Down
2 changes: 0 additions & 2 deletions Client/mods/deathmatch/logic/luadefs/CLuaBuildingDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ CClientBuilding* CLuaBuildingDefs::CreateBuilding(lua_State* const luaVM, std::u
else
rot.emplace(CVector(0, 0, 0));

m_pBuildingManager->ResizePoolIfNeeds();

CClientBuilding* pBuilding = new CClientBuilding(m_pManager, INVALID_ELEMENT_ID, modelId, pos, rot.value() , interior.value_or(0));

CClientEntity* pRoot = pResource->GetResourceDynamicEntity();
Expand Down

0 comments on commit fbaff85

Please sign in to comment.