Commit a3b02022 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

ncurses: fix NULL deref

in empty directory
parent 3ef51621
...@@ -303,10 +303,11 @@ static void ReadDir(intf_thread_t *intf) ...@@ -303,10 +303,11 @@ static void ReadDir(intf_thread_t *intf)
continue; continue;
} }
closedir(current_dir);
if (sys->n_dir_entries > 0)
qsort(sys->dir_entries, sys->n_dir_entries, qsort(sys->dir_entries, sys->n_dir_entries,
sizeof(struct dir_entry_t*), &comdir_entries); sizeof(struct dir_entry_t*), &comdir_entries);
closedir(current_dir);
} }
/***************************************************************************** /*****************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment