files: do not try writing to the status bar while not in curses mode

Between an endwin() and a doupdate() there should be no calls of
statusline() or statusbar() -- these two functions may be called
only when in curses mode.

This fixes https://savannah.gnu.org/bugs/?58868.

Bug existed since version 4.3, commit 57390cff.
master
Benno Schulenberg 2020-08-02 10:23:45 +02:00
parent eb57b10273
commit 312bcebf44
1 changed files with 4 additions and 3 deletions

View File

@ -658,10 +658,8 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable)
while ((onevalue = getc_unlocked(f)) != EOF) {
char input = (char)onevalue;
if (control_C_was_pressed) {
statusline(ALERT, _("Interrupted"));
if (control_C_was_pressed)
break;
}
/* When the byte before the current one is a CR and we're doing
* format conversion, then strip this CR when it's before a LF
@ -735,6 +733,9 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable)
if (ferror(f) && errornumber != EINTR && errornumber != 0)
statusline(ALERT, strerror(errornumber));
if (control_C_was_pressed)
statusline(ALERT, _("Interrupted"));
fclose(f);
if (fd > 0 && !undoable && !ISSET(VIEW_MODE))