Fixed segfault on :autocmd without group (#115).
authorDaniel Carl <danielcarl@gmx.de>
Thu, 16 Oct 2014 19:59:13 +0000 (21:59 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Thu, 16 Oct 2014 19:59:13 +0000 (21:59 +0200)
src/autocmd.c

index 179c70d..4ac3569 100644 (file)
@@ -163,11 +163,12 @@ gboolean autocmd_add(char *name, gboolean delete)
 
             /* group is found - get the next word */
             word = get_next_word(&parse);
-        } else {
-            /* no group found - use the current one */
-            grp = curgroup;
         }
     }
+    if (!grp) {
+        /* no group found - use the current one */
+        grp = curgroup;
+    }
 
     /* parse event name - if none was matched run it for all events */
     if (word) {