playlist_state: don't save "current" song when none is set

This patch fixes an assertion failure:

 Assertion `order < queue->length' failed.

This happens when the state file is saved, when there is no "current"
song: current==-1, and queue_order_to_position(-1) is called.
This commit is contained in:
Max Kellermann 2009-06-29 22:27:57 +02:00
parent a641f562f3
commit 706614b0d7

View File

@ -68,9 +68,11 @@ playlist_state_save(FILE *fp, const struct playlist *playlist)
getPlayerElapsedTime());
} else {
fprintf(fp, "%s\n", PLAYLIST_STATE_FILE_STATE_STOP);
fprintf(fp, "%s%i\n", PLAYLIST_STATE_FILE_CURRENT,
if (playlist->current >= 0)
fprintf(fp, "%s%i\n", PLAYLIST_STATE_FILE_CURRENT,
queue_order_to_position(&playlist->queue,
playlist->current));
playlist->current));
}
fprintf(fp, "%s%i\n", PLAYLIST_STATE_FILE_RANDOM,