Merge pull request #112 from joerg-krause/fix-out-of-bounds-panic

Fix out of bounds panic
This commit is contained in:
Paul Lietar 2016-08-23 16:53:23 -07:00 committed by GitHub
commit 95f42d19c9

View file

@ -209,11 +209,14 @@ impl SpircInternal {
} }
self.reload_tracks(&frame); self.reload_tracks(&frame);
if self.tracks.len() > 0 {
let play = frame.get_state().get_status() == PlayStatus::kPlayStatusPlay; let play = frame.get_state().get_status() == PlayStatus::kPlayStatusPlay;
let track = self.tracks[self.index as usize]; let track = self.tracks[self.index as usize];
let position = frame.get_state().get_position_ms(); let position = frame.get_state().get_position_ms();
self.player.load(track, play, position); self.player.load(track, play, position);
} else {
self.notify(false, Some(frame.get_ident()));
}
} }
MessageType::kMessageTypePlay => { MessageType::kMessageTypePlay => {
self.player.play(); self.player.play();