Merge pull request #92422 from groud/fix_navigation_baking_crash

Fix crash when baking TileMap navigation
This commit is contained in:
Rémi Verschelde 2024-05-28 15:49:57 +02:00
commit 607fa8229b
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 1 additions and 1 deletions

View File

@ -263,7 +263,7 @@ void NavMeshGenerator2D::generator_parse_geometry_node(Ref<NavigationPolygon> p_
// Special case for TileMap, so that internal layer get parsed even if p_recurse_children is false. // Special case for TileMap, so that internal layer get parsed even if p_recurse_children is false.
for (int i = 0; i < p_node->get_child_count(); i++) { for (int i = 0; i < p_node->get_child_count(); i++) {
TileMapLayer *tile_map_layer = Object::cast_to<TileMapLayer>(p_node->get_child(i)); TileMapLayer *tile_map_layer = Object::cast_to<TileMapLayer>(p_node->get_child(i));
if (tile_map_layer->get_index_in_tile_map() >= 0) { if (tile_map_layer && tile_map_layer->get_index_in_tile_map() >= 0) {
generator_parse_tile_map_layer_node(p_navigation_mesh, p_source_geometry_data, tile_map_layer); generator_parse_tile_map_layer_node(p_navigation_mesh, p_source_geometry_data, tile_map_layer);
} }
} }