From 47a910bccc0a9ebc77cc98f5c932c36fde8486cc Mon Sep 17 00:00:00 2001 From: Erik Hofman Date: Sat, 31 Mar 2012 11:45:28 +0200 Subject: [PATCH] Make sure _avionics is enabled before calling suspend, this fixes a crash caused by the way AI models are handled now. --- src/Sound/fg_fx.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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(); -- 2.39.5