From: Orestis Floros Date: Sun, 9 Sep 2018 13:09:39 +0000 (+0300) Subject: tree_restore: Check croot X-Git-Tag: 4.16~44^2~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a3dcee35f3a7739fb8f3e19d59e9064f696859cc;p=i3%2Fi3 tree_restore: Check croot Related to #2414, #3156. --- diff --git a/src/tree.c b/src/tree.c index 96766b6a..5a7c5dfa 100644 --- a/src/tree.c +++ b/src/tree.c @@ -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);