From e0235244812c011b9d0cc589c27ee65e5223bec6 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 27 Aug 2014 18:12:43 -0400 Subject: player: don't sort a NULL list This can occur if the directory does not have any files in it which causes files to never be non-NULL for qsort. --- player/scripting.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/player/scripting.c b/player/scripting.c index 0393427bef..1efe6389f6 100644 --- a/player/scripting.c +++ b/player/scripting.c @@ -151,7 +151,8 @@ static char **list_script_files(void *talloc_ctx, char *path) MP_TARRAY_APPEND(talloc_ctx, files, count, fname); } closedir(dp); - qsort(files, count, sizeof(char *), compare_filename); + if (files) + qsort(files, count, sizeof(char *), compare_filename); MP_TARRAY_APPEND(talloc_ctx, files, count, NULL); return files; } -- cgit v1.2.3