Merge pull request #46665 from nekomatata/fix-crash-convex-shape-2d

Fix errors and crash with empty ConvexPolygonShape2D
This commit is contained in:
Rémi Verschelde 2021-03-04 20:19:16 +01:00 committed by GitHub
commit 6b2577599f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);