summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
authorJuan Linietsky <juan@godotengine.org>2019-03-02 12:04:24 -0300
committerJuan Linietsky <juan@godotengine.org>2019-03-02 12:04:24 -0300
commit1b8f56c099cf0bdf8c209e7ebfcadcaa769989f2 (patch)
tree9c5d1684dd4a1ce7c97b872fd1c4c031326d10c6 /scene/2d
parent6dc2669361f8d84bfb5674b4f410240b72916fdd (diff)
Clean up and fix some situations where triangulation may fail, closes #26366
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/polygon_2d.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp
index 1c58073f1d..f6f1bad581 100644
--- a/scene/2d/polygon_2d.cpp
+++ b/scene/2d/polygon_2d.cpp
@@ -307,7 +307,9 @@ void Polygon2D::_notification(int p_what) {
if (invert || polygons.size() == 0) {
Vector<int> indices = Geometry::triangulate_polygon(points);
- VS::get_singleton()->canvas_item_add_triangle_array(get_canvas_item(), indices, points, colors, uvs, bones, weights, texture.is_valid() ? texture->get_rid() : RID());
+ if (indices.size()) {
+ VS::get_singleton()->canvas_item_add_triangle_array(get_canvas_item(), indices, points, colors, uvs, bones, weights, texture.is_valid() ? texture->get_rid() : RID());
+ }
} else {
//draw individual polygons
Vector<int> total_indices;