commit d3dd403dc7565c3bd362996b3b602714a1e9e76b
parent 7f4c2c6a2556ecab6a8c2018a5f44b7fbdfc092d
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Mon, 24 Jul 2023 15:12:48 +0200
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>
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/browser.c b/src/browser.c
@@ -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;