From 66bfefbf1adce31e83fd0ad1305013877f5fce04 Mon Sep 17 00:00:00 2001 From: Gabriel Vlasiu Date: Thu, 29 Aug 2024 21:03:08 +0300 Subject: [PATCH] Ticket #4580: mceditor: segfault on new file creation. (edit_init): fix NULL dereference. Signed-off-by: Andrew Borodin --- src/editor/edit.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/editor/edit.c b/src/editor/edit.c index aaf79bf8c7..99b131513a 100644 --- a/src/editor/edit.c +++ b/src/editor/edit.c @@ -2164,7 +2164,10 @@ edit_init (WEdit *edit, const WRect *r, const edit_arg_t *arg) edit->stat1.st_gid = getgid (); edit->stat1.st_mtime = 0; - edit->attrs_ok = (mc_fgetflags (arg->file_vpath, &edit->attrs) == 0); + if (arg != NULL) + edit->attrs_ok = (mc_fgetflags (arg->file_vpath, &edit->attrs) == 0); + else + edit->attrs_ok = FALSE; edit->over_col = 0; edit->bracket = -1;