commit ac31669ec3884cb7254cb4d2e249c600e7172887 parent 86c08560ad45fd905c49a9cb9eeee10c5af31bb3 Author: Benno Schulenberg <bensberg@telfort.nl> Date: Fri, 25 May 2018 19:25:11 +0200 linter: don't try to access absent stat info, as that gives a crash This fixes https://savannah.gnu.org/bugs/?53981. Diffstat:
M | src/text.c | | | 10 | ++++++---- |
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/text.c b/src/text.c @@ -3267,16 +3267,18 @@ void do_linter(void) struct stat lintfileinfo; if (stat(curlint->filename, &lintfileinfo) != -1 && - openfile->current_stat->st_ino != lintfileinfo.st_ino) { + (openfile->current_stat == NULL || + openfile->current_stat->st_ino != lintfileinfo.st_ino)) { #ifdef ENABLE_MULTIBUFFER const openfilestruct *started_at = openfile; openfile = openfile->next; - while (openfile != started_at && - openfile->current_stat->st_ino != lintfileinfo.st_ino) + while (openfile != started_at && (openfile->current_stat == NULL || + openfile->current_stat->st_ino != lintfileinfo.st_ino)) openfile = openfile->next; - if (openfile->current_stat->st_ino != lintfileinfo.st_ino) { + if (openfile->current_stat == NULL || + openfile->current_stat->st_ino != lintfileinfo.st_ino) { char *msg = charalloc(1024 + strlen(curlint->filename)); int i;