Skip to content

Commit

Permalink
Fix NavigationMeshSourceGeometryData merge crash
Browse files Browse the repository at this point in the history
Fixes crash when trying to merge with a null source geometry.
  • Loading branch information
smix8 committed Apr 10, 2024
1 parent 83b916b commit 497afea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions scene/resources/navigation_mesh_source_geometry_data_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ void NavigationMeshSourceGeometryData2D::add_obstruction_outline(const PackedVec
}

void NavigationMeshSourceGeometryData2D::merge(const Ref<NavigationMeshSourceGeometryData2D> &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);
Expand Down
2 changes: 2 additions & 0 deletions scene/resources/navigation_mesh_source_geometry_data_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ void NavigationMeshSourceGeometryData3D::add_faces(const PackedVector3Array &p_f
}

void NavigationMeshSourceGeometryData3D::merge(const Ref<NavigationMeshSourceGeometryData3D> &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();
Expand Down

0 comments on commit 497afea

Please sign in to comment.