aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-06-29 22:27:57 +0200
committerMax Kellermann <max@duempel.org>2009-06-29 22:27:57 +0200
commit706614b0d77b665805f78da24681af13454de774 (patch)
tree2b8ff780ad5ac6dcb2a4433fee6e2283c788f1a7 /src
parenta641f562f3aab2de95555c3c33133341d0f274b7 (diff)
downloadmpd-706614b0d77b665805f78da24681af13454de774.tar.gz
mpd-706614b0d77b665805f78da24681af13454de774.tar.xz
mpd-706614b0d77b665805f78da24681af13454de774.zip
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.
Diffstat (limited to '')
-rw-r--r--src/playlist_state.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/playlist_state.c b/src/playlist_state.c
index 9530b7d36..c9d3303ac 100644
--- a/src/playlist_state.c
+++ b/src/playlist_state.c
@@ -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,