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:
parent
a641f562f3
commit
706614b0d7
@ -68,9 +68,11 @@ playlist_state_save(FILE *fp, const struct playlist *playlist)
|
|||||||
getPlayerElapsedTime());
|
getPlayerElapsedTime());
|
||||||
} else {
|
} else {
|
||||||
fprintf(fp, "%s\n", PLAYLIST_STATE_FILE_STATE_STOP);
|
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,
|
queue_order_to_position(&playlist->queue,
|
||||||
playlist->current));
|
playlist->current));
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(fp, "%s%i\n", PLAYLIST_STATE_FILE_RANDOM,
|
fprintf(fp, "%s%i\n", PLAYLIST_STATE_FILE_RANDOM,
|
||||||
|
Loading…
Reference in New Issue
Block a user