mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-25 23:17:28 +00:00
Add null checks to all free calls to prevent crash on server close. (#709)
This commit is contained in:
parent
e6c7f744b5
commit
88f316bf93
@ -28,13 +28,13 @@ dNavMesh::dNavMesh(uint32_t zoneId) {
|
|||||||
dNavMesh::~dNavMesh() {
|
dNavMesh::~dNavMesh() {
|
||||||
// Clean up Recast information
|
// Clean up Recast information
|
||||||
|
|
||||||
rcFreeHeightField(m_Solid);
|
if(m_Solid) rcFreeHeightField(m_Solid);
|
||||||
rcFreeCompactHeightfield(m_CHF);
|
if (m_CHF) rcFreeCompactHeightfield(m_CHF);
|
||||||
rcFreeContourSet(m_CSet);
|
if (m_CSet) rcFreeContourSet(m_CSet);
|
||||||
rcFreePolyMesh(m_PMesh);
|
if (m_PMesh) rcFreePolyMesh(m_PMesh);
|
||||||
rcFreePolyMeshDetail(m_PMDMesh);
|
if (m_PMDMesh) rcFreePolyMeshDetail(m_PMDMesh);
|
||||||
dtFreeNavMesh(m_NavMesh);
|
if (m_NavMesh) dtFreeNavMesh(m_NavMesh);
|
||||||
dtFreeNavMeshQuery(m_NavQuery);
|
if (m_NavQuery) dtFreeNavMeshQuery(m_NavQuery);
|
||||||
|
|
||||||
if (m_Ctx) delete m_Ctx;
|
if (m_Ctx) delete m_Ctx;
|
||||||
if (m_Triareas) delete[] m_Triareas;
|
if (m_Triareas) delete[] m_Triareas;
|
||||||
|
@ -32,9 +32,10 @@ dpWorld::~dpWorld() {
|
|||||||
m_Grid = nullptr;
|
m_Grid = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_NavMesh->~dNavMesh();
|
if (m_NavMesh) {
|
||||||
delete m_NavMesh;
|
delete m_NavMesh;
|
||||||
m_NavMesh = nullptr;
|
m_NavMesh = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dpWorld::StepWorld(float deltaTime) {
|
void dpWorld::StepWorld(float deltaTime) {
|
||||||
|
@ -42,5 +42,5 @@ private:
|
|||||||
std::vector<dpEntity*> m_StaticEntities;
|
std::vector<dpEntity*> m_StaticEntities;
|
||||||
std::vector<dpEntity*> m_DynamicEntites;
|
std::vector<dpEntity*> m_DynamicEntites;
|
||||||
|
|
||||||
dNavMesh* m_NavMesh;
|
dNavMesh* m_NavMesh = nullptr;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user