diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-04-06 22:35:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-06 22:35:49 +0200 |
commit | 68b28c6cd4e0af28adf168eec5d76143c32df04d (patch) | |
tree | f15d910738dc66641bf8802d752aa6425931013d /servers/physics_2d | |
parent | 7fa84d8bd36974f622add931cb4c29302e4f6bee (diff) | |
parent | 2abfc0518f6a2d7587d54d82b7edf26976585409 (diff) |
Merge pull request #47678 from madmiraal/fix-47436.1
Check for empty ConcavePolygonShape2D before checking for intersection
Diffstat (limited to 'servers/physics_2d')
-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 8343899906..6cc086b9b7 100644 --- a/servers/physics_2d/shape_2d_sw.cpp +++ b/servers/physics_2d/shape_2d_sw.cpp @@ -693,6 +693,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 { |