summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2019-01-20 16:43:55 +0100
committerYorhel <git@yorhel.nl>2019-01-20 16:43:59 +0100
commit2501fb1ad574dda6d2f38c34b71033189a97340e (patch)
tree99e81f452a4b02159af049ad80cf16dbecadd06b
parent93583e645f4f173dd9af32e678c2ec6c85a121ae (diff)
Fix crash when attempting to sort an empty directory
I had taken care to not sort empty directories during dirlist_open(), but forgot that manual user actions can still cause dirlist_set_sort() to be called, which does not handle empty directories. Reported by Alex Wilson.
-rw-r--r--src/dirlist.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/dirlist.c b/src/dirlist.c
index 3b4c655..da51a98 100644
--- a/src/dirlist.c
+++ b/src/dirlist.c
@@ -371,7 +371,8 @@ void dirlist_set_sort(int col, int desc, int df) {
dirlist_sort_df = df;
/* sort the list (excluding the parent, which is always on top) */
- head_real = dirlist_sort(head_real);
+ if(head_real)
+ head_real = dirlist_sort(head_real);
if(dirlist_parent)
dirlist_parent->next = head_real;
else