From 47e802e6747cea6e6e9bc21f6b11c2885a29f694 Mon Sep 17 00:00:00 2001 From: James Turner Date: Mon, 30 Dec 2013 17:16:53 +0000 Subject: [PATCH] Fix for the fix: check for a viewer. - avoid a crash if we bail out before creating the viewer (missing data or bad aircraft) --- src/Main/globals.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Main/globals.cxx b/src/Main/globals.cxx index 9c714f6cb..fb3a35480 100644 --- a/src/Main/globals.cxx +++ b/src/Main/globals.cxx @@ -214,8 +214,10 @@ FGGlobals::~FGGlobals() // don't cancel the pager until after shutdown, since AIModels (and // potentially others) can queue delete requests on the pager. - renderer->getViewer()->getDatabasePager()->cancel(); - renderer->getViewer()->getDatabasePager()->clear(); + if (renderer->getViewer() && renderer->getViewer()->getDatabasePager()) { + renderer->getViewer()->getDatabasePager()->cancel(); + renderer->getViewer()->getDatabasePager()->clear(); + } osgDB::Registry::instance()->clearObjectCache(); // renderer touches subsystems during its destruction