]> git.sur5r.net Git - i3/i3/commitdiff
tree_restore: Check croot
authorOrestis Floros <orestisf1993@gmail.com>
Sun, 9 Sep 2018 13:09:39 +0000 (16:09 +0300)
committerOrestis Floros <orestisf1993@gmail.com>
Sun, 9 Sep 2018 13:11:48 +0000 (16:11 +0300)
Related to #2414, #3156.

src/tree.c

index 96766b6a4f9346e37682d44f03c45a3e84728441..5a7c5dfa3c7f37be659b0e4b0a7025ef22fdbef8 100644 (file)
@@ -92,6 +92,10 @@ bool tree_restore(const char *path, xcb_get_geometry_reply_t *geometry) {
 
     DLOG("appended tree, using new root\n");
     croot = TAILQ_FIRST(&(croot->nodes_head));
+    if (!croot) {
+        /* tree_append_json failed. Continuing here would segfault. */
+        goto out;
+    }
     DLOG("new root = %p\n", croot);
     Con *out = TAILQ_FIRST(&(croot->nodes_head));
     DLOG("out = %p\n", out);