FlpImport: fixed crash on invalid notes

Added a range check for channel parameter when adding notes. This fixes
a crash when for example importing the project posted on lmms-devel
by Andew Kelley lately.
(cherry picked from commit ee9d88e2d4)
This commit is contained in:
Tobias Doerffel
2009-08-09 11:10:10 +02:00
parent 9a4cfedf67
commit 3e62853de5

View File

@@ -1310,7 +1310,14 @@ if( p.currentEffectChannel <= NumFxChannels )
len /= (4*ppq) / DefaultTicksPerTact;
note n( len, pos, key, vol * 100 / 128,
pan*200 / 128 - 100 );
if( ch < p.numChannels )
{
p.channels[ch].notes.push_back( qMakePair( p.currentPattern, n ) );
}
else
{
qDebug( "invalid " );
}
qDebug( "note: " );
dump_mem( text+i*bpn, bpn );
}