Fix for RC bug [780675] MI2: Reoccuring crash

Tightened up OOB track selection handling in
MidiParser. Apparently some SMFs in the Mac
version of MI2 (and other games?) specify
track -1 in their jump commands to indicate
a jump within the same track.

svn-id: r9321
This commit is contained in:
Jamieson Christian 2003-07-31 06:50:13 +00:00
parent c5de745580
commit 7c16006cc7
2 changed files with 3 additions and 3 deletions

View File

@ -698,8 +698,8 @@ void Player::key_off(uint8 chan, byte note) {
bool Player::jump(uint track, uint beat, uint tick) {
if (!_parser)
return false;
_track_index = track;
_parser->setTrack (track);
if (_parser->setTrack (track))
_track_index = track;
if (!_parser->jumpToTick ((beat - 1) * TICKS_PER_BEAT + tick))
return false;
turn_off_pedals();

View File

@ -252,7 +252,7 @@ void MidiParser::resetTracking() {
}
bool MidiParser::setTrack (int track) {
if (track >= _num_tracks)
if (track < 0 || track >= _num_tracks)
return false;
else if (track == _active_track)
return true;