Break loop if is_true was set to false in If
[mikachu/openbox.git] / openbox / actions / if.c
index a083d48..fd8e1bd 100644 (file)
@@ -313,7 +313,7 @@ static gboolean run_func_if(ObActionsData *data, gpointer options)
     gboolean is_true = TRUE;
 
     guint i;
-    for (i = 0; i < o->queries->len; ++i) {
+    for (i = 0; is_true && i < o->queries->len; ++i) {
         Query *q = g_array_index(o->queries, Query*, i);
         ObClient *query_target = NULL;
 
@@ -327,7 +327,10 @@ static gboolean run_func_if(ObActionsData *data, gpointer options)
         }
 
         /* If there's no client to query, then false. */
-        is_true &= query_target != NULL;
+        if (!query_target) {
+            is_true = FALSE;
+            break;
+        }
 
         if (q->shaded_on)
             is_true &= query_target->shaded;