summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Catania <info@andreacatania.com>2018-08-29 17:34:26 +0200
committerAndrea Catania <info@andreacatania.com>2018-08-29 17:34:26 +0200
commit9a67a07a2c339fa4e847b28160093f02ceb64eaf (patch)
treef3ed2d429db13574c535b6f4b63fcf699d80765c
parent39cbb992c3f84e9fcd06b5e991536b431c396fb6 (diff)
Fixed crash if convex has 0 vertices
-rw-r--r--modules/bullet/shape_bullet.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/modules/bullet/shape_bullet.cpp b/modules/bullet/shape_bullet.cpp
index fab8d0cf3d..cc7d106496 100644
--- a/modules/bullet/shape_bullet.cpp
+++ b/modules/bullet/shape_bullet.cpp
@@ -340,6 +340,9 @@ void ConvexPolygonShapeBullet::setup(const Vector<Vector3> &p_vertices) {
}
btCollisionShape *ConvexPolygonShapeBullet::create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge) {
+ if (!vertices.size())
+ // This is necessary since 0 vertices
+ return prepare(ShapeBullet::create_shape_empty());
btCollisionShape *cs(ShapeBullet::create_shape_convex(vertices));
cs->setLocalScaling(p_implicit_scale);
prepare(cs);