From c1598361ca7d7337d192375e99c8cdf8fcdb81ed Mon Sep 17 00:00:00 2001 From: jmt Date: Mon, 14 Sep 2009 22:41:29 +0000 Subject: [PATCH] navradio: fix crash spotted by Torsten, when nav range is unspecified. --- src/Instrumentation/navradio.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Instrumentation/navradio.cxx b/src/Instrumentation/navradio.cxx index cf05bc764..19e29a226 100644 --- a/src/Instrumentation/navradio.cxx +++ b/src/Instrumentation/navradio.cxx @@ -271,6 +271,10 @@ FGNavRadio::unbind () double FGNavRadio::adjustNavRange( double stationElev, double aircraftElev, double nominalRange ) { + if (nominalRange < 0.0) { + nominalRange = FG_NAV_DEFAULT_RANGE; + } + // extend out actual usable range to be 1.3x the published safe range const double usability_factor = 1.3; @@ -454,7 +458,7 @@ void FGNavRadio::updateReceiver(double dt) effective_range = adjustNavRange( nav_elev, pos.getElevationM(), _navaid->get_range() ); } - + double effective_range_m = effective_range * SG_NM_TO_METER; ////////////////////////////////////////////////////////// -- 2.39.5