1
0
Fork 0

Fix crash on exit

NasalModelDataProxy destructor relies on globals being valid.
This commit is contained in:
Stuart Buchanan 2022-11-27 14:29:11 +00:00
parent ccf674e189
commit e6c2e258b5

View file

@ -181,12 +181,14 @@ FGNasalModelData* FGNasalModelData::getByModuleId(unsigned int id)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
FGNasalModelDataProxy::~FGNasalModelDataProxy() FGNasalModelDataProxy::~FGNasalModelDataProxy()
{ {
auto nasalSys = globals->get_subsystem<FGNasalSys>(); if (globals) {
auto nasalSys = globals->get_subsystem<FGNasalSys>();
// when necessary, register Nasal module to be destroyed/unloaded // when necessary, register Nasal module to be destroyed/unloaded
// in the main thread. // in the main thread.
if ((_data.valid())&&(nasalSys)) if ((_data.valid())&&(nasalSys))
nasalSys->registerToUnload(_data); nasalSys->registerToUnload(_data);
}
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------