Fixed crash if convex has 0 vertices

This commit is contained in:
Andrea Catania 2018-08-29 17:34:26 +02:00
parent 39cbb992c3
commit 9a67a07a2c
1 changed files with 3 additions and 0 deletions

View File

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