]> git.mxchange.org Git - flightgear.git/commitdiff
#178 related: avoid sim from freezing when FDM goes wild
authorThorstenB <brehmt@gmail.com>
Sun, 26 Jun 2011 14:18:36 +0000 (16:18 +0200)
committerThorstenB <brehmt@gmail.com>
Sun, 26 Jun 2011 14:18:36 +0000 (16:18 +0200)
src/Instrumentation/heading_indicator_dg.cxx

index bb9c1620e4f3e11d2f64f79633ed0a189f39b56b..a4c478be06e2aee8814dcf466129b3f409e41362 100644 (file)
@@ -153,6 +153,10 @@ HeadingIndicatorDG::update (double dt)
     _last_heading_deg = heading;
 
     heading += offset + align + error;
+    // sanity check: bail out when the FDM runs wild, to avoid
+    // SG_NORMALIZE_RANGE from freezing on huge/infinite numbers.
+    if (fabs(heading)>1e10)
+        return;
     SG_NORMALIZE_RANGE(heading, 0.0, 360.0);
 
     _heading_out_node->setDoubleValue(heading);