From: Erik Hofman Date: Sat, 31 Mar 2012 09:45:28 +0000 (+0200) Subject: Make sure _avionics is enabled before calling suspend, this fixes a crash caused... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=47a910bccc0a9ebc77cc98f5c932c36fde8486cc;p=flightgear.git Make sure _avionics is enabled before calling suspend, this fixes a crash caused by the way AI models are handled now. --- diff --git a/src/Sound/fg_fx.cxx b/src/Sound/fg_fx.cxx index b9bbaacc8..b9cd492e4 100644 --- a/src/Sound/fg_fx.cxx +++ b/src/Sound/fg_fx.cxx @@ -144,16 +144,16 @@ void FGFX::update (double dt) { if ( _enabled->getBoolValue() ) { - if ( _avionics_enabled->getBoolValue() && - (_avionics_ext->getBoolValue() || - _internal->getBoolValue())) + if ( _avionics_enabled->getBoolValue()) { - // avionics sound is enabled - _avionics->resume(); // no-op if already in resumed state - _avionics->set_volume( _avionics_volume->getFloatValue() ); + if (_avionics_ext->getBoolValue() || _internal->getBoolValue()) { + // avionics sound is enabled + _avionics->resume(); // no-op if already in resumed state + _avionics->set_volume( _avionics_volume->getFloatValue() ); + } + else + _avionics->suspend(); } - else - _avionics->suspend(); set_volume( _volume->getDoubleValue() ); resume();