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