shithub: dumb

Download patch

ref: 1f89a5627cfc0c48aa13a1d6bcb060847119206b
parent: 1f2e7f8d46858490d0bd6a5e4855a4c168a8a31f
author: Chris Moeller <kode54@gmail.com>
date: Mon Jan 11 04:01:06 EST 2010

{10/4/2008 3:54:34 PM}Fixed xm_note_off for when instrument number is out of range.

git-tfs-id: [http://localhost:8080/tfs/DefaultCollection/]$/foobar2000/files/plugins.root;C201

--- a/dumb/src/it/itrender.c
+++ b/dumb/src/it/itrender.c
@@ -1399,7 +1399,8 @@
 static void xm_note_off(DUMB_IT_SIGDATA *sigdata, IT_CHANNEL *channel)
 {
 	if (channel->playing) {
-		if (!(sigdata->instrument[channel->instrument-1].volume_envelope.flags & IT_ENVELOPE_ON))
+		if (channel->instrument > sigdata->n_instruments ||
+			!(sigdata->instrument[channel->instrument-1].volume_envelope.flags & IT_ENVELOPE_ON))
 			//if (!(entry->mask & IT_ENTRY_INSTRUMENT))
 			// dunno what that was there for ...
 				channel->volume = 0;