From: Daniel Carl Date: Tue, 10 Mar 2015 20:41:11 +0000 (+0100) Subject: Fix segfault on bookmark completion (#189). X-Git-Url: https://git.owens.tech///git?a=commitdiff_plain;h=ed5f069ae747a22359e3c2e3be8a17d3bceb71a5;p=vimb.git Fix segfault on bookmark completion (#189). If the bookmark file contained lines without any tab char, the completion caused a segfault. --- diff --git a/src/bookmark.c b/src/bookmark.c index 218daec..8c8ea2d 100644 --- a/src/bookmark.c +++ b/src/bookmark.c @@ -317,10 +317,10 @@ static Bookmark *line_to_bookmark(const char *uri, const char *data) char *p; Bookmark *bm; - /* data part may consist of title or titletags*/ + /* data part may consist of title or titletags */ bm = g_slice_new(Bookmark); bm->uri = g_strdup(uri); - if ((p = strchr(data, '\t'))) { + if (data && (p = strchr(data, '\t'))) { *p = '\0'; bm->title = g_strdup(data); bm->tags = g_strdup(p + 1);