Resolves crash on shape2D culling for empty Concave shapes

Fixes https://github.com/godotengine/godot/issues/17789
This commit is contained in:
Crazy-P 2018-04-12 18:15:34 +08:00
parent 23fc8ca223
commit 158c7c72c7
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;
*/
if (segments.size() == 0 || points.size() == 0 || bvh.size() == 0) {
return;
}
int level = 0;
const Segment *segmentptr = &segments[0];

View file

@ -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;