From 27782d7c8b2f8355208ac3ccd7971a02275f9c94 Mon Sep 17 00:00:00 2001 From: Csaba Halasz Date: Sun, 31 Oct 2010 00:36:54 +0200 Subject: [PATCH] Added null pointer check to AI subsystem tear down in FGGlobals destructor to avoid crash when using --help option --- 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 db6eef28c..c28c9f5d2 100644 --- a/src/Main/globals.cxx +++ b/src/Main/globals.cxx @@ -167,8 +167,10 @@ FGGlobals::~FGGlobals() // shut down all subsystems, make sure we take down the // AIModels system first. SGSubsystem* ai = subsystem_mgr->remove("ai_model"); - ai->unbind(); - delete ai; + if (ai) { + ai->unbind(); + delete ai; + } subsystem_mgr->unbind(); delete subsystem_mgr; -- 2.39.5