From 6c0002afb53fb6501ea61060bd3c40c7472f36b6 Mon Sep 17 00:00:00 2001 From: PouleyKetchoupp Date: Thu, 4 Mar 2021 09:46:32 -0700 Subject: [PATCH] Fix errors and crash with empty ConvexPolygonShape2D (cherry picked from commit 6fb609074895b8681cc42af866782e4963567a23) --- scene/resources/convex_polygon_shape_2d.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scene/resources/convex_polygon_shape_2d.cpp b/scene/resources/convex_polygon_shape_2d.cpp index a51df4851a6..a0368e59584 100644 --- a/scene/resources/convex_polygon_shape_2d.cpp +++ b/scene/resources/convex_polygon_shape_2d.cpp @@ -78,6 +78,9 @@ void ConvexPolygonShape2D::_bind_methods() { } void ConvexPolygonShape2D::draw(const RID &p_to_rid, const Color &p_color) { + if (points.size() < 3) { + return; + } Vector col; col.push_back(p_color);