From: Daniel Carl Date: Mon, 27 May 2013 17:24:36 +0000 (+0200) Subject: Fixed segfault and glib errors (#23). X-Git-Url: https://git.owens.tech/style.css/style.css/git?a=commitdiff_plain;h=6891a738faa9ef04d4594c93a12fb68cb4de3e11;p=vimb.git Fixed segfault and glib errors (#23). --- diff --git a/src/bookmark.c b/src/bookmark.c index 9e8c300..ab88aaf 100644 --- a/src/bookmark.c +++ b/src/bookmark.c @@ -58,11 +58,15 @@ void bookmark_add(const char *uri, const char *tags) */ GList *bookmark_get_by_tags(const char *tags) { - GList *res = NULL; - GList *src = load(vb.files[FILES_BOOKMARK]); + GList *res = NULL, *src = NULL; char **parts; unsigned int len; + if (!tags) { + return NULL; + } + + src = load(vb.files[FILES_BOOKMARK]); parts = g_strsplit(tags, " ", 0); len = g_strv_length(parts); diff --git a/src/command.c b/src/command.c index 1a82b0d..3a77867 100644 --- a/src/command.c +++ b/src/command.c @@ -382,7 +382,7 @@ gboolean command_map(const Arg *arg) vb_set_mode(VB_MODE_NORMAL, false); - if ((key = strchr(arg->s, '='))) { + if (arg->s && (key = strchr(arg->s, '='))) { *key = '\0'; if (arg->s) { return keybind_add_from_string(arg->s, key + 1, arg->i);