Commit b5abc023 authored by Max Kellermann's avatar Max Kellermann

playlist: assert in playPlaylistIfPlayerStopped()

The function playPlaylistIfPlayerStopped() is only called when the player thread is stopped. Converted that runtime check into an assertion, and remove one indent level.
parent cfbafbef
...@@ -783,23 +783,23 @@ void nextSongInPlaylist(void) ...@@ -783,23 +783,23 @@ void nextSongInPlaylist(void)
static void playPlaylistIfPlayerStopped(void) static void playPlaylistIfPlayerStopped(void)
{ {
if (getPlayerState() == PLAYER_STATE_STOP) { enum player_error error;
enum player_error error = getPlayerError();
assert(playlist.playing);
assert(getPlayerState() == PLAYER_STATE_STOP);
error = getPlayerError();
if (error == PLAYER_ERROR_NOERROR) if (error == PLAYER_ERROR_NOERROR)
playlist_errorCount = 0; playlist_errorCount = 0;
else else
playlist_errorCount++; playlist_errorCount++;
if (playlist.playing if ((playlist_stopOnError && error != PLAYER_ERROR_NOERROR) ||
&& ((playlist_stopOnError && error != PLAYER_ERROR_NOERROR) error == PLAYER_ERROR_AUDIO || error == PLAYER_ERROR_SYSTEM ||
|| error == PLAYER_ERROR_AUDIO playlist_errorCount >= queue_length(&playlist.queue))
|| error == PLAYER_ERROR_SYSTEM
|| playlist_errorCount >= queue_length(&playlist.queue))) {
stopPlaylist(); stopPlaylist();
} else else
nextSongInPlaylist(); nextSongInPlaylist();
}
} }
bool getPlaylistRepeatStatus(void) bool getPlaylistRepeatStatus(void)
......
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