Avoid crash when try build navmesh with null scene

This commit is contained in:
Mr. Capybara
2023-11-14 14:47:35 -04:00
parent 46f82aabcd
commit d533cf554a

View File

@@ -1067,6 +1067,12 @@ void NavMeshBuilder::Update()
void NavMeshBuilder::Build(Scene* scene, float timeoutMs)
{
if (!scene)
{
LOG(Warning, "Could not generate navmesh without scene.");
return;
}
// Early out if scene is not using navigation
if (scene->Navigation.Volumes.IsEmpty())
{
@@ -1098,6 +1104,17 @@ void NavMeshBuilder::Build(Scene* scene, float timeoutMs)
void NavMeshBuilder::Build(Scene* scene, const BoundingBox& dirtyBounds, float timeoutMs)
{
if (!scene)
{
LOG(Warning, "Could not generate navmesh without scene.");
return;
}
if (!&dirtyBounds)
{
LOG(Warning, "Could not generate navmesh without dirty bounds.");
return;
}
// Early out if scene is not using navigation
if (scene->Navigation.Volumes.IsEmpty())
{