browser: report an error instead of crashing when the folder disappears
When the directory that the user is browsing in is deleted by another process at the moment that nano is building the list of file names, this can result in an empty list, which some items in the main loop in browse() cannot handle. Prevent this mishandling by not entering the loop when the list is empty. This fixes https://savannah.gnu.org/bugs/?64465. Reported-by: Jerry Meng <jerrytstng@gmail.com>
This commit is contained in:
@@ -436,7 +436,10 @@ char *browse(char *path)
|
||||
|
||||
titlebar(path);
|
||||
|
||||
while (TRUE) {
|
||||
if (list_length == 0) {
|
||||
statusline(ALERT, _("No entries"));
|
||||
napms(1200);
|
||||
} else while (TRUE) {
|
||||
functionptrtype function;
|
||||
int kbinput;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user