diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-03-04 20:19:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-04 20:19:16 +0100 |
commit | 6b2577599ff3ead44e92bd8e0ad688811d323a1d (patch) | |
tree | 1d64a7e757527bef55afd89bd792cb7ea6e7fdcf /scene | |
parent | 4c10d31bc42f0d01d1b6a8042413a8886d19f987 (diff) | |
parent | 6fb609074895b8681cc42af866782e4963567a23 (diff) |
Merge pull request #46665 from nekomatata/fix-crash-convex-shape-2d
Fix errors and crash with empty ConvexPolygonShape2D
Diffstat (limited to 'scene')
-rw-r--r-- | scene/resources/convex_polygon_shape_2d.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/scene/resources/convex_polygon_shape_2d.cpp b/scene/resources/convex_polygon_shape_2d.cpp index d331f83daf..6e56f6e7fc 100644 --- a/scene/resources/convex_polygon_shape_2d.cpp +++ b/scene/resources/convex_polygon_shape_2d.cpp @@ -72,6 +72,10 @@ void ConvexPolygonShape2D::_bind_methods() { } void ConvexPolygonShape2D::draw(const RID &p_to_rid, const Color &p_color) { + if (points.size() < 3) { + return; + } + Vector<Color> col; col.push_back(p_color); RenderingServer::get_singleton()->canvas_item_add_polygon(p_to_rid, points, col); |