mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-01-13 01:08:41 -09:00
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.
This commit is contained in:
parent
93583e645f
commit
2501fb1ad5
1 changed files with 2 additions and 1 deletions
|
|
@ -371,7 +371,8 @@ void dirlist_set_sort(int col, int desc, int df) {
|
||||||
dirlist_sort_df = df;
|
dirlist_sort_df = df;
|
||||||
|
|
||||||
/* sort the list (excluding the parent, which is always on top) */
|
/* 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)
|
if(dirlist_parent)
|
||||||
dirlist_parent->next = head_real;
|
dirlist_parent->next = head_real;
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue