From d533cf554afc07a7d47cf7ee76b8bd9cd8d24496 Mon Sep 17 00:00:00 2001 From: "Mr. Capybara" Date: Tue, 14 Nov 2023 14:47:35 -0400 Subject: [PATCH] Avoid crash when try build navmesh with null scene --- Source/Engine/Navigation/NavMeshBuilder.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Source/Engine/Navigation/NavMeshBuilder.cpp b/Source/Engine/Navigation/NavMeshBuilder.cpp index b0959cb34..894dc1e52 100644 --- a/Source/Engine/Navigation/NavMeshBuilder.cpp +++ b/Source/Engine/Navigation/NavMeshBuilder.cpp @@ -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()) {