]> git.sur5r.net Git - i3/i3/commitdiff
Always add to the focus list, fixes crash.
authorFernando Tarlá Cardoso Lemos <fernandotcl@gmail.com>
Mon, 22 Nov 2010 23:28:21 +0000 (21:28 -0200)
committerMichael Stapelberg <michael@stapelberg.de>
Fri, 26 Nov 2010 22:26:53 +0000 (23:26 +0100)
src/con.c

index 2454684e7c439616ee4a1858a09c91e9403cd626..4824510f95992475b87cf27df14f36623cb0962a 100644 (file)
--- a/src/con.c
+++ b/src/con.c
@@ -85,19 +85,19 @@ void con_attach(Con *con, Con *parent) {
             if (con->num < current->num) {
                 /* we need to insert the container at the beginning */
                 TAILQ_INSERT_HEAD(nodes_head, con, nodes);
-                return;
-            }
-            while (current->num != -1 && con->num > current->num) {
-                current = TAILQ_NEXT(current, nodes);
-                if (current == TAILQ_END(nodes_head)) {
-                    current = NULL;
-                    break;
+            } else {
+                while (current->num != -1 && con->num > current->num) {
+                    current = TAILQ_NEXT(current, nodes);
+                    if (current == TAILQ_END(nodes_head)) {
+                        current = NULL;
+                        break;
+                    }
                 }
+                /* we need to insert con after current, if current is not NULL */
+                if (current)
+                    TAILQ_INSERT_BEFORE(current, con, nodes);
+                else TAILQ_INSERT_TAIL(nodes_head, con, nodes);
             }
-            /* we need to insert con after current, if current is not NULL */
-            if (current)
-                TAILQ_INSERT_BEFORE(current, con, nodes);
-            else TAILQ_INSERT_TAIL(nodes_head, con, nodes);
         }
         goto add_to_focus_head;
     }