From f733bf17e9a32a499a55507c416ad04a17a9beb5 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 8 May 2008 17:02:08 +0000 Subject: [PATCH] Added missing check against handling invalid bounding sphere's --- src/osg/BoundingSphere.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/osg/BoundingSphere.cpp b/src/osg/BoundingSphere.cpp index e87001d5a..558eb150d 100644 --- a/src/osg/BoundingSphere.cpp +++ b/src/osg/BoundingSphere.cpp @@ -93,6 +93,8 @@ void BoundingSphere::expandRadiusBy(const Vec3d& v) void BoundingSphere::expandBy(const BoundingSphere& sh) { + // ignore operation if incomming BoundingSphere is invalid. + if (!sh.valid()) return; // This sphere is not set so use the inbound sphere if (!valid()) @@ -102,7 +104,7 @@ void BoundingSphere::expandBy(const BoundingSphere& sh) return; } - + // Calculate d == The distance between the sphere centers double d = ( _center - sh.center() ).length();