From 8451286bb5367c6cf270e5081785e0f351079225 Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Wed, 7 Mar 2012 22:44:24 +0300 Subject: [PATCH] Ticket #2695: Fixed segfault while new file created in editor. Signed-off-by: Slava Zanko --- lib/lock.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/lock.c b/lib/lock.c index f59adfab5..faaed1ea5 100644 --- a/lib/lock.c +++ b/lib/lock.c @@ -201,9 +201,12 @@ lock_file (const vfs_path_t * fname_vpath) gboolean symlink_ok = FALSE; const char *elpath; + if (fname_vpath == NULL) + return 0; + elpath = vfs_path_get_by_index (fname_vpath, 0)->path; /* Just to be sure (and don't lock new file) */ - if (fname_vpath == NULL || *elpath == '\0') + if (*elpath == '\0') return 0; /* Locking on VFS is not supported */ @@ -272,9 +275,12 @@ unlock_file (const vfs_path_t * fname_vpath) struct stat statbuf; const char *elpath; + if (fname_vpath == NULL) + return 0; + elpath = vfs_path_get_by_index (fname_vpath, 0)->path; /* Just to be sure (and don't lock new file) */ - if (fname_vpath == NULL || *elpath == '\0') + if (*elpath == '\0') return 0; lockfname = lock_build_symlink_name (fname_vpath); -- 2.11.4.GIT