summaryrefslogtreecommitdiff
path: root/servers/physics_2d
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2018-05-07 15:35:33 -0300
committerGitHub <noreply@github.com>2018-05-07 15:35:33 -0300
commit4897373015cf984d5a57344d9933980e53cb96e6 (patch)
treea998d240b93da18954ff802ad175c48f8922195b /servers/physics_2d
parentf1d2b0ebf9317ffd661c2c129527e2334ba39367 (diff)
parent158c7c72c741ad58f22dfdcade74d4e893cd33c5 (diff)
Merge pull request #18144 from Crazy-P/Resolves-crash-on-shape2D-culling-for-empty-Concave-shapes
Resolves crash on shape2D culling for empty Concave shapes
Diffstat (limited to 'servers/physics_2d')
-rw-r--r--servers/physics_2d/shape_2d_sw.cpp4
-rw-r--r--servers/physics_2d/space_2d_sw.cpp1
2 files changed, 5 insertions, 0 deletions
diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp
index 433942708e..2b0eab5999 100644
--- a/servers/physics_2d/shape_2d_sw.cpp
+++ b/servers/physics_2d/shape_2d_sw.cpp
@@ -1011,6 +1011,10 @@ void ConcavePolygonShape2DSW::cull(const Rect2 &p_local_aabb, Callback p_callbac
stack[i]=0;
*/
+ if (segments.size() == 0 || points.size() == 0 || bvh.size() == 0) {
+ return;
+ }
+
int level = 0;
const Segment *segmentptr = &segments[0];
diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp
index c29093d1af..503ca0af4a 100644
--- a/servers/physics_2d/space_2d_sw.cpp
+++ b/servers/physics_2d/space_2d_sw.cpp
@@ -33,6 +33,7 @@
#include "collision_solver_2d_sw.h"
#include "pair.h"
#include "physics_2d_server_sw.h"
+
_FORCE_INLINE_ static bool _can_collide_with(CollisionObject2DSW *p_object, uint32_t p_collision_mask) {
return p_object->get_collision_layer() & p_collision_mask;