diff --git a/src/Scripting/NasalModelData.cxx b/src/Scripting/NasalModelData.cxx index 03aab808a..fc335836a 100644 --- a/src/Scripting/NasalModelData.cxx +++ b/src/Scripting/NasalModelData.cxx @@ -181,12 +181,14 @@ FGNasalModelData* FGNasalModelData::getByModuleId(unsigned int id) //------------------------------------------------------------------------------ FGNasalModelDataProxy::~FGNasalModelDataProxy() { - auto nasalSys = globals->get_subsystem(); + if (globals) { + auto nasalSys = globals->get_subsystem(); - // when necessary, register Nasal module to be destroyed/unloaded - // in the main thread. - if ((_data.valid())&&(nasalSys)) - nasalSys->registerToUnload(_data); + // when necessary, register Nasal module to be destroyed/unloaded + // in the main thread. + if ((_data.valid())&&(nasalSys)) + nasalSys->registerToUnload(_data); + } } //------------------------------------------------------------------------------