Fixed segfault on yank without buffer.
authorDaniel Carl <danielcarl@gmx.de>
Tue, 3 Jun 2014 12:13:18 +0000 (14:13 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Tue, 3 Jun 2014 12:13:18 +0000 (14:13 +0200)
src/command.c
src/main.c

index cdf0404..88a9c70 100644 (file)
@@ -102,9 +102,7 @@ gboolean command_yank(const Arg *arg, char buf)
         }
         if (text) {
             /* put the text into the yank buffer */
-            if (strchr(VB_USER_REG, buf)) {
-                vb_register_add(buf, text);
-            }
+            vb_register_add(buf, text);
             vb_echo(VB_MSG_NORMAL, false, tmpl, text);
             g_free(text);
 
@@ -125,9 +123,7 @@ gboolean command_yank(const Arg *arg, char buf)
     if (a.s) {
         /* put the text into the yank buffer */
         vb_set_clipboard(&a);
-        if (strchr(VB_USER_REG, buf)) {
-            vb_register_add(buf, a.s);
-        }
+        vb_register_add(buf, a.s);
         vb_echo(VB_MSG_NORMAL, false, tmpl, a.s);
 
         return true;
index 076a6ad..ac44a25 100644 (file)
@@ -984,7 +984,7 @@ void vb_register_add(char buf, const char *value)
     char *mark;
     int idx;
 
-    if (!vb.state.enable_register) {
+    if (!vb.state.enable_register || !buf) {
         return;
     }