diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2021-04-06 21:03:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-06 21:03:00 +0200 |
commit | 17e0ad9d5b5881a32b559d2ec78075f1465965f2 (patch) | |
tree | 3be73f80fba3afa8319d1135359c0d54ccf10293 | |
parent | 55faf1c874fae5b67928395d3a35889bbb4e458b (diff) | |
parent | 0d4d8925b7ebaf608e0b3c2abf0d8213d9ce95f7 (diff) |
Merge pull request #47666 from madmiraal/fix-46137
Ensure ConvexPolygonShape2D support count variable is initialised
-rw-r--r-- | servers/physics_2d/shape_2d_sw.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp index 6e7e802a8b..9b02fb692e 100644 --- a/servers/physics_2d/shape_2d_sw.cpp +++ b/servers/physics_2d/shape_2d_sw.cpp @@ -502,6 +502,7 @@ Variant CapsuleShape2DSW::get_data() const { void ConvexPolygonShape2DSW::get_supports(const Vector2 &p_normal, Vector2 *r_supports, int &r_amount) const { int support_idx = -1; real_t d = -1e10; + r_amount = 0; for (int i = 0; i < point_count; i++) { //test point @@ -520,7 +521,7 @@ void ConvexPolygonShape2DSW::get_supports(const Vector2 &p_normal, Vector2 *r_su } } - ERR_FAIL_COND(support_idx == -1); + ERR_FAIL_COND_MSG(support_idx == -1, "Convex polygon shape support not found."); r_amount = 1; r_supports[0] = points[support_idx].pos; |