Commit 706614b0 authored by Max Kellermann's avatar Max Kellermann

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.
parent a641f562
......@@ -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,
......
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