From 9cdb65d5c7a9287190674e06d4d462b41fc8a8f2 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 24 Jun 2016 10:09:59 +0100 Subject: [PATCH] Restructed to handle dyanmic_cast<> being NULL --- src/osgUI/PushButton.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/osgUI/PushButton.cpp b/src/osgUI/PushButton.cpp index 4b70d17b8..cb83961ae 100644 --- a/src/osgUI/PushButton.cpp +++ b/src/osgUI/PushButton.cpp @@ -106,10 +106,12 @@ void PushButton::createGraphicsImplementation() // create label. osg::ref_ptr node = style->createText(extents, getAlignmentSettings(), getTextSettings(), _text); - _textDrawable = dynamic_cast(node.get()); - _textDrawable->setDataVariance(osg::Object::DYNAMIC); - group->addChild(_textDrawable.get()); + _textDrawable = dynamic_cast(node.get()); + + node->setDataVariance(osg::Object::DYNAMIC); + + group->addChild(node.get()); style->setupClipStateSet(_extents, getOrCreateWidgetStateSet());