From 72b4844d4207d3a8913a0823d21bafcc4af93ed4 Mon Sep 17 00:00:00 2001 From: Michael Alexsander Silva Dias Date: Tue, 2 Apr 2019 11:45:18 -0300 Subject: [PATCH] Fix crash when using the Tileset Editor when the given shape has no points (cherry picked from commit 9501900e1bd44b9aa2feb32b636c9bc9283a8363) --- editor/plugins/tile_set_editor_plugin.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index dc099b84a7c..54e6e5b154e 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -2417,9 +2417,11 @@ void TileSetEditor::draw_polygon_shapes() { colors.push_back(c_bg); } } - if (polygon.size() > 2) { - workspace->draw_polygon(polygon, colors); - } + + if (polygon.size() < 3) + continue; + + workspace->draw_polygon(polygon, colors); if (coord == edited_shape_coord || tileset->tile_get_tile_mode(get_current_tile()) == TileSet::SINGLE_TILE) { if (!creating_shape) {