From eaa6813917498b84eb3ea02adb3d2ab3b26e08ad Mon Sep 17 00:00:00 2001
From: Chris Robinson <chris.kcat@gmail.com>
Date: Thu, 28 Feb 2013 13:54:53 -0800
Subject: [PATCH] Workaround for meshes without any vertices

---
 components/nifogre/ogre_nif_loader.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/components/nifogre/ogre_nif_loader.cpp b/components/nifogre/ogre_nif_loader.cpp
index e6779ac1a..a86487854 100644
--- a/components/nifogre/ogre_nif_loader.cpp
+++ b/components/nifogre/ogre_nif_loader.cpp
@@ -844,9 +844,12 @@ class NIFMeshLoader : Ogre::ManualResourceLoader
         // Set the bounding box first
         BoundsFinder bounds;
         bounds.add(&srcVerts[0][0], srcVerts.size());
-        // No idea why this offset is needed. It works fine without it if the
-        // vertices weren't transformed first, but otherwise it fails later on
-        // when the object is being inserted into the scene.
+        if(!bounds.isValid())
+        {
+            float v[3] = { 0.0f, 0.0f, 0.0f };
+            bounds.add(&v[0], 1);
+        }
+
         mesh->_setBounds(Ogre::AxisAlignedBox(bounds.minX()-0.5f, bounds.minY()-0.5f, bounds.minZ()-0.5f,
                                               bounds.maxX()+0.5f, bounds.maxY()+0.5f, bounds.maxZ()+0.5f));
         mesh->_setBoundingSphereRadius(bounds.getRadius());