don't segfault on 'set' without arguments.
authorBrendan Taylor <whateley@gmail.com>
Wed, 24 Jun 2009 02:30:40 +0000 (20:30 -0600)
committerBrendan Taylor <whateley@gmail.com>
Wed, 24 Jun 2009 02:30:40 +0000 (20:30 -0600)
fixes FS#44

uzbl.c

diff --git a/uzbl.c b/uzbl.c
index e6e9551..29c80b3 100644 (file)
--- a/uzbl.c
+++ b/uzbl.c
@@ -704,9 +704,11 @@ static void
 set_var(WebKitWebView *page, GArray *argv) {
     (void) page;
     gchar **split = g_strsplit(argv_idx(argv, 0), "=", 2);
-    gchar *value = parseenv(g_strdup(split[1] ? g_strchug(split[1]) : " "));
-    set_var_value(g_strstrip(split[0]), value);
-    g_free(value);
+    if (split[0] != NULL) {
+        gchar *value = parseenv(g_strdup(split[1] ? g_strchug(split[1]) : " "));
+        set_var_value(g_strstrip(split[0]), value);
+        g_free(value);
+    }
     g_strfreev(split);
 }