From ef93e42136f713132bb1ad0dbd700ae8bcf126f3 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 24 Jun 2016 11:31:15 +0100 Subject: [PATCH] Added handling of dynamic_cast<> returning NULL --- src/osgPresentation/PickEventHandler.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/osgPresentation/PickEventHandler.cpp b/src/osgPresentation/PickEventHandler.cpp index 8a7e6cd9d..0e07e3141 100644 --- a/src/osgPresentation/PickEventHandler.cpp +++ b/src/osgPresentation/PickEventHandler.cpp @@ -53,6 +53,9 @@ bool PickEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA { if (ea.getHandled()) return false; + osgViewer::Viewer* viewer = dynamic_cast(&aa); + if (!viewer) return false; + switch(ea.getEventType()) { case(osgGA::GUIEventAdapter::MOVE): @@ -64,7 +67,6 @@ bool PickEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA { _drawablesOnPush.clear(); } - osgViewer::Viewer* viewer = dynamic_cast(&aa); osgUtil::LineSegmentIntersector::Intersections intersections; if (viewer->computeIntersections(ea, nv->getNodePath(), intersections)) {