hedgewars/uSound.pas
changeset 10490 b30b8d39d662
parent 10254 eb28335df088
child 10510 9329dab04490
--- a/hedgewars/uSound.pas	Tue Nov 11 21:55:38 2014 +0100
+++ b/hedgewars/uSound.pas	Tue Nov 11 23:57:46 2014 +0300
@@ -435,14 +435,17 @@
         end;
 
     i:= 0;
-    while (i<8) and (VoiceList[i].snd <> sndNone) do
+    while (i <= High(VoiceList)) and (VoiceList[i].snd <> sndNone) do
         inc(i);
 
     // skip playing same sound for same hog twice
     if (i>0) and (VoiceList[i-1].snd = snd) and (VoiceList[i-1].voicepack = voicepack) then
         exit;
-    VoiceList[i].snd:= snd;
-    VoiceList[i].voicepack:= voicepack;
+    if(i <= High(VoiceList)) then
+        begin
+        VoiceList[i].snd:= snd;
+        VoiceList[i].voicepack:= voicepack;
+        end
 end;
 
 procedure PlayNextVoice;