summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorGilles Roudière <gilles.roudiere@gmail.com>2024-05-27 10:46:54 +0200
committerGilles Roudière <gilles.roudiere@gmail.com>2024-05-27 10:46:54 +0200
commit1a380db62ace18ab12d577f06af3e34a8e74696c (patch)
tree74320796699faec88df6b04b7a5ae993f00f0e13 /modules
parentbe56cab58c056c074d1e02cd0b38641204e39f41 (diff)
downloadredot-engine-1a380db62ace18ab12d577f06af3e34a8e74696c.tar.gz
Fix crash when baking TileMap navigation
Diffstat (limited to 'modules')
-rw-r--r--modules/navigation/2d/nav_mesh_generator_2d.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/navigation/2d/nav_mesh_generator_2d.cpp b/modules/navigation/2d/nav_mesh_generator_2d.cpp
index 2198158f9c..ace361a08a 100644
--- a/modules/navigation/2d/nav_mesh_generator_2d.cpp
+++ b/modules/navigation/2d/nav_mesh_generator_2d.cpp
@@ -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.
for (int i = 0; i < p_node->get_child_count(); 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);
}
}