]> git.mxchange.org Git - flightgear.git/commitdiff
GPWS: avoid "altitude_callout_voice != NULL" assertion
authorThorstenB <brehmt@gmail.com>
Fri, 21 Jan 2011 18:55:42 +0000 (19:55 +0100)
committerThorstenB <brehmt@gmail.com>
Fri, 21 Jan 2011 18:55:42 +0000 (19:55 +0100)
Properly remember which active alerts were already voiced.
Added NULL-pointer safety check

src/Instrumentation/mk_viii.cxx

index 745ed6c2e378217713b9e859dda69bd8f2e18a12..8fb871a4ab5d853a94b4e30faa4d7f901d0d4f66 100755 (executable)
@@ -2319,6 +2319,8 @@ MK_VIII::VoicePlayer::get_sample (const char *name)
 void
 MK_VIII::VoicePlayer::play (Voice *_voice, unsigned int flags)
 {
+  if (!_voice)
+      return;
   if (test_bits(flags, PLAY_NOW) || ! voice || voice->element->silence)
     {
       if (voice)
@@ -2978,9 +2980,10 @@ MK_VIII::AlertHandler::update ()
        mk->voice_player.play(mk_voice(bank_angle_pause_bank_angle));
     }
 
-  // set new state
-
-  old_alerts = voice_alerts;
+  // remember all alerts voiced so far...
+  old_alerts |= voice_alerts;
+  // ... forget those no longer active
+  old_alerts &= alerts;
   repeated_alerts = 0;
 }