Browse Source

Do not crash if the polygon is invalid

Juan Linietsky 7 years ago
parent
commit
c4d0f528b1
1 changed files with 3 additions and 0 deletions
  1. 3 0
      modules/csg/csg_shape.cpp

+ 3 - 0
modules/csg/csg_shape.cpp

@@ -226,6 +226,9 @@ AABB CSGShape::get_aabb() const {
 PoolVector<Vector3> CSGShape::get_brush_faces() {
 	ERR_FAIL_COND_V(!is_inside_tree(), PoolVector<Vector3>());
 	CSGBrush *b = _get_brush();
+	if (!b) {
+		return PoolVector<Vector3>();
+	}
 
 	PoolVector<Vector3> faces;
 	int fc = b->faces.size();