diff options
author | Marcel Admiraal <madmiraal@users.noreply.github.com> | 2021-04-06 19:43:51 +0100 |
---|---|---|
committer | Marcel Admiraal <madmiraal@users.noreply.github.com> | 2021-04-06 20:05:10 +0100 |
commit | 2abfc0518f6a2d7587d54d82b7edf26976585409 (patch) | |
tree | 1d800209a0150ad607d2df487fabd76c62fb2fca /servers/physics_2d/shape_2d_sw.cpp | |
parent | 55faf1c874fae5b67928395d3a35889bbb4e458b (diff) |
Check for empty ConcavePolygonShape2D before checking for intersection
Diffstat (limited to 'servers/physics_2d/shape_2d_sw.cpp')
-rw-r--r-- | servers/physics_2d/shape_2d_sw.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp index 6e7e802a8b..a74f6e2f87 100644 --- a/servers/physics_2d/shape_2d_sw.cpp +++ b/servers/physics_2d/shape_2d_sw.cpp @@ -691,6 +691,10 @@ bool ConcavePolygonShape2DSW::contains_point(const Vector2 &p_point) const { } bool ConcavePolygonShape2DSW::intersect_segment(const Vector2 &p_begin, const Vector2 &p_end, Vector2 &r_point, Vector2 &r_normal) const { + if (segments.size() == 0 || points.size() == 0) { + return false; + } + uint32_t *stack = (uint32_t *)alloca(sizeof(int) * bvh_depth); enum { |