From 3525fff8d079538cb36c506b01fdb10128f7c187 Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Wed, 19 Mar 2014 16:31:17 +0100 Subject: [PATCH] CanvasGroup: return empty bounding box without children. Return an invalid bounding box can lead to problems if used unchecked. Just returning an empty bounding box (size 0x0 and position at the origin of the element) is much safer. --- simgear/canvas/elements/CanvasGroup.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/simgear/canvas/elements/CanvasGroup.cxx b/simgear/canvas/elements/CanvasGroup.cxx index 51523f42..3e284f12 100644 --- a/simgear/canvas/elements/CanvasGroup.cxx +++ b/simgear/canvas/elements/CanvasGroup.cxx @@ -220,7 +220,10 @@ namespace canvas //---------------------------------------------------------------------------- osg::BoundingBox Group::getTransformedBounds(const osg::Matrix& m) const { - osg::BoundingBox bb; + // Default to a bounding box with size 0x0 and the origin defined by the + // matrix. + osg::BoundingBox bb(m.getTrans(), m.getTrans()); + if( !_transform.valid() ) { warnTransformExpired("getTransformedBounds"); -- 2.39.5