Ticket #2695: fixed segfault on newly created files in editor

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Slava Zanko 2012-03-12 17:43:05 +03:00
parent 5eb1ada34e
commit 316cac613c

View File

@ -127,9 +127,14 @@ edit_save_file (WEdit * edit, const vfs_path_t * filename_vpath)
vfs_path_t *real_filename_vpath; vfs_path_t *real_filename_vpath;
vfs_path_t *savename_vpath = NULL; vfs_path_t *savename_vpath = NULL;
const char *start_filename; const char *start_filename;
const vfs_path_element_t *vpath_element;
start_filename = vfs_path_get_by_index (filename_vpath, 0)->path; vpath_element = vfs_path_get_by_index (filename_vpath, 0);
if (filename_vpath == NULL || *start_filename == '\0') if (vpath_element == NULL)
return 0;
start_filename = vpath_element->path;
if (*start_filename == '\0')
return 0; return 0;
if (*start_filename != PATH_SEP && edit->dir_vpath != NULL) if (*start_filename != PATH_SEP && edit->dir_vpath != NULL)