]> git.tdb.fi Git - r2c2.git/blobdiff - source/3d/layout.cpp
Avoid crash if an object does not have a shape
[r2c2.git] / source / 3d / layout.cpp
index fe3514f4cd29437627cd1f213833e6e2f759a3ff..be19b0020a9a2680b64e4750690cd288b0b8c1c6 100644 (file)
@@ -41,7 +41,11 @@ void Layout3D::get_bounds(Vector &minp, Vector &maxp) const
        Geometry::BoundingBox<float, 3> bbox;
 
        for(ObjectMap::const_iterator i=objects.begin(); i!=objects.end(); ++i)
-               bbox = bbox|i->second->get_object().get_type().get_shape()->get_axis_aligned_bounding_box();
+       {
+               const Shape *shape = i->second->get_object().get_shape();
+               if(shape)
+                       bbox = bbox|shape->get_axis_aligned_bounding_box();
+       }
 
        minp = bbox.get_minimum_point();
        maxp = bbox.get_maximum_point();
@@ -52,7 +56,7 @@ void Layout3D::add(Object3D &o)
        insert_unique(objects, &o.get_object(), &o);
 }
 
-Object3D &Layout3D::get(Object &o) const
+Object3D &Layout3D::get_3d(Object &o) const
 {
        return *get_item(objects, &o);
 }