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.
This commit is contained in:
Max Kellermann 2009-01-23 06:40:52 +01:00
parent cfbafbefdc
commit b5abc02379

View File

@ -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();
if (error == PLAYER_ERROR_NOERROR) assert(playlist.playing);
playlist_errorCount = 0; assert(getPlayerState() == PLAYER_STATE_STOP);
else
playlist_errorCount++;
if (playlist.playing error = getPlayerError();
&& ((playlist_stopOnError && error != PLAYER_ERROR_NOERROR) if (error == PLAYER_ERROR_NOERROR)
|| error == PLAYER_ERROR_AUDIO playlist_errorCount = 0;
|| error == PLAYER_ERROR_SYSTEM else
|| playlist_errorCount >= queue_length(&playlist.queue))) { playlist_errorCount++;
stopPlaylist();
} else if ((playlist_stopOnError && error != PLAYER_ERROR_NOERROR) ||
nextSongInPlaylist(); error == PLAYER_ERROR_AUDIO || error == PLAYER_ERROR_SYSTEM ||
} playlist_errorCount >= queue_length(&playlist.queue))
stopPlaylist();
else
nextSongInPlaylist();
} }
bool getPlaylistRepeatStatus(void) bool getPlaylistRepeatStatus(void)