summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-05-25 19:42:51 +0200
committerwm4 <wm4@nowhere>2014-05-25 19:42:51 +0200
commit9d0e5f6da64e2ee9936dd859d43e7d26fd42bde3 (patch)
treeaa91f61607ae93ca60666f1ef496fe81ad65b738 /common
parentba1447822cb46944a2de960a8f2523a92f19f749 (diff)
downloadmpv-9d0e5f6da64e2ee9936dd859d43e7d26fd42bde3.tar.bz2
mpv-9d0e5f6da64e2ee9936dd859d43e7d26fd42bde3.tar.xz
playlist: fix playlist_move on itself
A playlist_move command that moves an entry onto itself (both arguments have the same index) should do nothing, but it did something broken. The underlying reason is that it checks the prev pointer of the entry which is temporarily removed for moving.
Diffstat (limited to 'common')
-rw-r--r--common/playlist.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/common/playlist.c b/common/playlist.c
index 9080a27ae9..e33fbd36c8 100644
--- a/common/playlist.c
+++ b/common/playlist.c
@@ -119,10 +119,13 @@ void playlist_clear(struct playlist *pl)
pl->current_was_replaced = false;
}
-// Moves entry such that entry->prev = at (even if at is NULL)
+// Moves the entry so that it takes "at"'s place (or move to end, if at==NULL).
void playlist_move(struct playlist *pl, struct playlist_entry *entry,
struct playlist_entry *at)
{
+ if (entry == at)
+ return;
+
struct playlist_entry *save_current = pl->current;
bool save_replaced = pl->current_was_replaced;