From d68ea994d56fc03d009eccbab079a7f51883d8ba Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 17 Nov 2015 01:51:21 +0100 Subject: [PATCH] Deal with empty meshes --- components/resource/bulletshapemanager.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/resource/bulletshapemanager.cpp b/components/resource/bulletshapemanager.cpp index c4e46321f..9aae1cad4 100644 --- a/components/resource/bulletshapemanager.cpp +++ b/components/resource/bulletshapemanager.cpp @@ -80,6 +80,9 @@ public: osg::ref_ptr getShape() { + if (!mTriangleMesh) + return osg::ref_ptr(); + osg::ref_ptr shape (new BulletShape); TriangleMeshShape* meshShape = new TriangleMeshShape(mTriangleMesh, true); shape->mCollisionShape = meshShape; @@ -134,6 +137,8 @@ osg::ref_ptr BulletShapeManager::createInstance(const std:: NodeToShapeVisitor visitor; node->accept(visitor); shape = visitor.getShape(); + if (!shape) + return osg::ref_ptr(); } mIndex[normalized] = shape;