From d0c341fa479b8c0bf5cde440d18d56c4b5eb5e1d Mon Sep 17 00:00:00 2001 From: James Turner Date: Tue, 22 Mar 2016 10:42:08 +0000 Subject: [PATCH] Guard against a crash. --- src/Viewer/fg_os_osgviewer.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Viewer/fg_os_osgviewer.cxx b/src/Viewer/fg_os_osgviewer.cxx index 498735fed..0799ffe4a 100644 --- a/src/Viewer/fg_os_osgviewer.cxx +++ b/src/Viewer/fg_os_osgviewer.cxx @@ -341,11 +341,12 @@ int fgOSMainLoop() int fgGetKeyModifiers() { - if (!globals->get_renderer()) { // happens during shutdown + FGRenderer* r = globals->get_renderer(); + if (!r || !r->getEventHandler()) { // happens during shutdown return 0; } - return globals->get_renderer()->getEventHandler()->getCurrentModifiers(); + return r->getEventHandler()->getCurrentModifiers(); } void fgWarpMouse(int x, int y) -- 2.39.5