summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-03-06 20:58:05 +0100
committerGitHub <noreply@github.com>2019-03-06 20:58:05 +0100
commit2f2fa8db690799c241d1c58514e35de9dc16dfbb (patch)
tree0d4625087ce3ec53f202d3f8daab181b23744417
parent9cddafa42cf197784b804b0f6686788be25aa1c3 (diff)
parent6c08f4ea4e69c2e903537be7ffbd9bac71f8c5e9 (diff)
Merge pull request #26722 from MarianoGnu/fix_24238
TileSetEditor: Don't draw invalid occlusion shapes. Fixes #24238
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index 5b54384ee0..dc099b84a7 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -2460,10 +2460,12 @@ void TileSetEditor::draw_polygon_shapes() {
workspace->draw_polygon(polygon, colors);
if (!creating_shape) {
- for (int j = 0; j < polygon.size() - 1; j++) {
- workspace->draw_line(polygon[j], polygon[j + 1], c_border, 1, true);
+ if (polygon.size() > 1) {
+ for (int j = 0; j < polygon.size() - 1; j++) {
+ workspace->draw_line(polygon[j], polygon[j + 1], c_border, 1, true);
+ }
+ workspace->draw_line(polygon[polygon.size() - 1], polygon[0], c_border, 1, true);
}
- workspace->draw_line(polygon[polygon.size() - 1], polygon[0], c_border, 1, true);
}
if (shape == edited_occlusion_shape) {
draw_handles = true;