From: Thomas Geymayer Date: Thu, 16 May 2013 21:06:30 +0000 (+0200) Subject: Do not crash if event has no graphics context assigned X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6a3354cb156b9871911ba81159e0affd13f16c82;p=flightgear.git Do not crash if event has no graphics context assigned --- diff --git a/src/Viewer/FGEventHandler.cxx b/src/Viewer/FGEventHandler.cxx index aa3d5ac49..c0978b164 100644 --- a/src/Viewer/FGEventHandler.cxx +++ b/src/Viewer/FGEventHandler.cxx @@ -151,6 +151,8 @@ eventToViewport(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us, y = -1; const osg::GraphicsContext* eventGC = ea.getGraphicsContext(); + if( !eventGC ) + return false; // TODO how can this happen? const osg::GraphicsContext::Traits* traits = eventGC->getTraits(); osg::Camera* guiCamera = getGUICamera(CameraGroup::getDefault()); if (!guiCamera)