X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FAIModel%2FAIBase.cxx;h=7cfcfcb0a33418517ff24f767da13d599e186191;hb=bcea720db3e29a62626b361f2149a7147e149f3b;hp=a17b9e47602b7ec8d1979f0bbf805d8e2360d448;hpb=21d50b11f5152e3fe76068eb693a3fa41c66efdd;p=flightgear.git diff --git a/src/AIModel/AIBase.cxx b/src/AIModel/AIBase.cxx index a17b9e476..7cfcfcb0a 100644 --- a/src/AIModel/AIBase.cxx +++ b/src/AIModel/AIBase.cxx @@ -143,12 +143,17 @@ FGAIBase::~FGAIBase() { model_removed->setStringValue(props->getPath()); } + // refID=0 is supposedley impossible, refID=1 is the special ai_ac aircaft + // representing the current user, in the ATCManager. Maybe both these + // tests could die? if (_fx && _refID != 0 && _refID != 1) { SGSoundMgr *smgr = globals->get_soundmgr(); - stringstream name; - name << "aifx:"; - name << _refID; - smgr->remove(name.str()); + if (smgr) { + stringstream name; + name << "aifx:"; + name << _refID; + smgr->remove(name.str()); + } } if (fp) @@ -245,11 +250,10 @@ void FGAIBase::update(double dt) { props->setStringValue("sim/sound/path", fxpath.c_str()); // initialize the sound configuration - SGSoundMgr *smgr = globals->get_soundmgr(); stringstream name; name << "aifx:"; name << _refID; - _fx = new FGFX(smgr, name.str(), props); + _fx = new FGFX(name.str(), props); _fx->init(); } }