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
This commit is contained in:
Juan Linietsky 2018-05-07 15:35:33 -03:00 committed by GitHub
commit 4897373015
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View file

@ -1011,6 +1011,10 @@ void ConcavePolygonShape2DSW::cull(const Rect2 &p_local_aabb, Callback p_callbac
stack[i]=0; stack[i]=0;
*/ */
if (segments.size() == 0 || points.size() == 0 || bvh.size() == 0) {
return;
}
int level = 0; int level = 0;
const Segment *segmentptr = &segments[0]; const Segment *segmentptr = &segments[0];

View file

@ -33,6 +33,7 @@
#include "collision_solver_2d_sw.h" #include "collision_solver_2d_sw.h"
#include "pair.h" #include "pair.h"
#include "physics_2d_server_sw.h" #include "physics_2d_server_sw.h"
_FORCE_INLINE_ static bool _can_collide_with(CollisionObject2DSW *p_object, uint32_t p_collision_mask) { _FORCE_INLINE_ static bool _can_collide_with(CollisionObject2DSW *p_object, uint32_t p_collision_mask) {
return p_object->get_collision_layer() & p_collision_mask; return p_object->get_collision_layer() & p_collision_mask;