From 7957a7bd2e6188ce7fcb3172587970cb7aa4315d Mon Sep 17 00:00:00 2001 From: Andrea Catania Date: Wed, 29 Aug 2018 17:34:26 +0200 Subject: [PATCH] Fixed crash if convex has 0 vertices (cherry picked from commit 9a67a07a2c339fa4e847b28160093f02ceb64eaf) --- modules/bullet/shape_bullet.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/bullet/shape_bullet.cpp b/modules/bullet/shape_bullet.cpp index 08171a6902d..16c4ffc95d0 100644 --- a/modules/bullet/shape_bullet.cpp +++ b/modules/bullet/shape_bullet.cpp @@ -291,6 +291,9 @@ void ConvexPolygonShapeBullet::setup(const Vector &p_vertices) { } btCollisionShape *ConvexPolygonShapeBullet::create_bt_shape(const btVector3 &p_implicit_scale, real_t p_margin) { + 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);