Skip to content

Commit 04e20e7

Browse files
sort: fix crash when sorting empty playlist
1 parent d1225ee commit 04e20e7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/sort.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,12 @@ plt_sort_internal (playlist_t *playlist, int iter, int id, ddb_tf_context_t *tf_
278278
}
279279

280280
pl_lock ();
281+
282+
if (playlist->count[iter] == 0) {
283+
pl_unlock ();
284+
return;
285+
}
286+
281287
struct timeval tm1;
282288
gettimeofday (&tm1, NULL);
283289
pl_sort_ascending = ascending;

0 commit comments

Comments
 (0)