From 2ccef6616e202af6127c458b0c5ac3f1b7921597 Mon Sep 17 00:00:00 2001 From: kobewi Date: Thu, 23 Jun 2022 14:34:23 +0200 Subject: [PATCH] Fix crash when drawing invalid tiles --- editor/plugins/tiles/tile_map_editor.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp index 77a3c075482..d914b9c363e 100644 --- a/editor/plugins/tiles/tile_map_editor.cpp +++ b/editor/plugins/tiles/tile_map_editor.cpp @@ -884,6 +884,9 @@ void TileMapEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p_over if (atlas_source) { // Get tile data. TileData *tile_data = atlas_source->get_tile_data(E.value.get_atlas_coords(), E.value.alternative_tile); + if (!tile_data) { + continue; + } // Compute the offset Rect2i source_rect = atlas_source->get_tile_texture_region(E.value.get_atlas_coords());