From 97c95ab49132ec7aec790ba419cf507fd467ea58 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 23 Jun 2016 16:48:00 +0100 Subject: [PATCH] Added check for null --- src/osgViewer/ScreenCaptureHandler.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/osgViewer/ScreenCaptureHandler.cpp b/src/osgViewer/ScreenCaptureHandler.cpp index 27a8eb3e6..b02753b9c 100644 --- a/src/osgViewer/ScreenCaptureHandler.cpp +++ b/src/osgViewer/ScreenCaptureHandler.cpp @@ -747,7 +747,10 @@ osg::Camera* ScreenCaptureHandler::findAppropriateCameraForCallback(osgViewer::V // of that view's graphics contexts. bool ScreenCaptureHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa) { - osgViewer::ViewerBase* viewer = dynamic_cast(&aa)->getViewerBase(); + osgViewer::View* view = dynamic_cast(&aa); + if (!view) return false; + + osgViewer::ViewerBase* viewer = view->getViewerBase(); if (!viewer) return false; switch(ea.getEventType())