From 497afeaf05d9844e79664343a277955edaf3ccf4 Mon Sep 17 00:00:00 2001 From: smix8 <52464204+smix8@users.noreply.github.com> Date: Wed, 10 Apr 2024 21:56:21 +0200 Subject: [PATCH] Fix NavigationMeshSourceGeometryData merge crash Fixes crash when trying to merge with a null source geometry. --- scene/resources/navigation_mesh_source_geometry_data_2d.cpp | 2 ++ scene/resources/navigation_mesh_source_geometry_data_3d.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/scene/resources/navigation_mesh_source_geometry_data_2d.cpp b/scene/resources/navigation_mesh_source_geometry_data_2d.cpp index dfa3b598c82..d613b498a12 100644 --- a/scene/resources/navigation_mesh_source_geometry_data_2d.cpp +++ b/scene/resources/navigation_mesh_source_geometry_data_2d.cpp @@ -120,6 +120,8 @@ void NavigationMeshSourceGeometryData2D::add_obstruction_outline(const PackedVec } void NavigationMeshSourceGeometryData2D::merge(const Ref &p_other_geometry) { + ERR_FAIL_NULL(p_other_geometry); + // No need to worry about `root_node_transform` here as the data is already xformed. traversable_outlines.append_array(p_other_geometry->traversable_outlines); obstruction_outlines.append_array(p_other_geometry->obstruction_outlines); diff --git a/scene/resources/navigation_mesh_source_geometry_data_3d.cpp b/scene/resources/navigation_mesh_source_geometry_data_3d.cpp index 1bd98fe1ace..39a17946fa8 100644 --- a/scene/resources/navigation_mesh_source_geometry_data_3d.cpp +++ b/scene/resources/navigation_mesh_source_geometry_data_3d.cpp @@ -172,6 +172,8 @@ void NavigationMeshSourceGeometryData3D::add_faces(const PackedVector3Array &p_f } void NavigationMeshSourceGeometryData3D::merge(const Ref &p_other_geometry) { + ERR_FAIL_NULL(p_other_geometry); + // No need to worry about `root_node_transform` here as the vertices are already xformed. const int64_t number_of_vertices_before_merge = vertices.size(); const int64_t number_of_indices_before_merge = indices.size();