Ticket #4580: mceditor: segfault on new file creation.

(edit_init): fix NULL dereference.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Gabriel Vlasiu 2024-08-29 21:03:08 +03:00 committed by Andrew Borodin
parent 876555035a
commit 66bfefbf1a
1 changed files with 4 additions and 1 deletions

View File

@ -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;