]> git.sur5r.net Git - i3/i3/blobdiff - src/commands.c
Merge pull request #2103 from Airblader/bug-2091
[i3/i3] / src / commands.c
index 5b28d03ead938b9384e27faac491b8a15299a020..78b1e993d6e5562573fc8f3640796cfcd7232cdf 100644 (file)
         }                                               \
     } while (0)
 
+/** If an error occured during parsing of the criteria, we want to exit instead
+ * of relying on fallback behavior. See #2091. */
+#define HANDLE_INVALID_MATCH                                   \
+    do {                                                       \
+        if (current_match->error != NULL) {                    \
+            yerror("Invalid match: %s", current_match->error); \
+            return;                                            \
+        }                                                      \
+    } while (0)
+
 /** When the command did not include match criteria (!), we use the currently
  * focused container. Do not confuse this case with a command which included
  * criteria but which did not match any windows. This macro has to be called in
@@ -49,6 +59,8 @@
  */
 #define HANDLE_EMPTY_MATCH                              \
     do {                                                \
+        HANDLE_INVALID_MATCH;                           \
+                                                        \
         if (match_is_empty(current_match)) {            \
             owindow *ow = smalloc(sizeof(owindow));     \
             ow->con = focused;                          \
@@ -1233,6 +1245,8 @@ void cmd_kill(I3_CMD, const char *kill_mode_str) {
         return;
     }
 
+    HANDLE_INVALID_MATCH;
+
     /* check if the match is empty, not if the result is empty */
     if (match_is_empty(current_match))
         tree_close_con(kill_mode);