Skip to content

Commit

Permalink
Merge pull request #46665 from nekomatata/fix-crash-convex-shape-2d
Browse files Browse the repository at this point in the history
Fix errors and crash with empty ConvexPolygonShape2D
  • Loading branch information
akien-mga authored Mar 4, 2021
2 parents 4c10d31 + 6fb6090 commit 6b25775
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scene/resources/convex_polygon_shape_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6b25775

Please sign in to comment.