summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-05-25 19:42:51 +0200
committerwm4 <wm4@nowhere>2014-06-14 13:47:18 +0200
commit213ea94ee34f05562bd5df188bac1400e7ea7822 (patch)
tree075c5bfae1074803956e5b7bdcce30669a77c195
parentf1409ceacf0df9b91ef69f79fdcac80e3fecf7ca (diff)
downloadmpv-213ea94ee34f05562bd5df188bac1400e7ea7822.tar.bz2
mpv-213ea94ee34f05562bd5df188bac1400e7ea7822.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.
-rw-r--r--common/playlist.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/common/playlist.c b/common/playlist.c
index 297cb4d379..40d88a4ff6 100644
--- a/common/playlist.c
+++ b/common/playlist.c
@@ -114,10 +114,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;