Commit f8810d7c authored by Max Kellermann's avatar Max Kellermann

PlaylistError: add NotPlaying()

parent 92f54f0b
......@@ -64,6 +64,11 @@ public:
return PlaylistError(PlaylistResult::BAD_RANGE,
"Bad song index");
}
static PlaylistError NotPlaying() {
return PlaylistError(PlaylistResult::NOT_PLAYING,
"Not playing");
}
};
#endif
......@@ -260,22 +260,15 @@ playlist::SeekCurrent(PlayerControl &pc,
SignedSongTime seek_time, bool relative,
Error &error)
{
if (!playing) {
error.Set(playlist_domain, int(PlaylistResult::NOT_PLAYING),
"Not playing");
return false;
}
if (!playing)
throw PlaylistError::NotPlaying();
if (relative) {
const auto status = pc.LockGetStatus();
if (status.state != PlayerState::PLAY &&
status.state != PlayerState::PAUSE) {
error.Set(playlist_domain,
int(PlaylistResult::NOT_PLAYING),
"Not playing");
return false;
}
status.state != PlayerState::PAUSE)
throw PlaylistError::NotPlaying();
seek_time += status.elapsed_time;
if (seek_time.IsNegative())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment