Fix switch from invalid navmesh number to valid

pull/541/head
elsid 6 years ago
parent 80051db8f8
commit 84fbb486d3
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40

@ -34,7 +34,7 @@ namespace MWRender
void NavMesh::update(const dtNavMesh& navMesh, const std::size_t id,
const std::size_t generation, const std::size_t revision, const DetourNavigator::Settings& settings)
{
if (!mEnabled || (mId == id && mGeneration >= generation && mRevision >= revision))
if (!mEnabled || (mGroup && mId == id && mGeneration >= generation && mRevision >= revision))
return;
mId = id;
@ -53,7 +53,10 @@ namespace MWRender
void NavMesh::reset()
{
if (mGroup)
{
mRootNode->removeChild(mGroup);
mGroup = nullptr;
}
}
void NavMesh::enable()
@ -65,7 +68,8 @@ namespace MWRender
void NavMesh::disable()
{
reset();
if (mGroup)
mRootNode->removeChild(mGroup);
mEnabled = false;
}
}

Loading…
Cancel
Save