From a3dcee35f3a7739fb8f3e19d59e9064f696859cc Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Sun, 9 Sep 2018 16:09:39 +0300 Subject: [PATCH] tree_restore: Check croot Related to #2414, #3156. --- src/tree.c | 4 ++++ 1 file changed, 4 insertions(+) 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); -- 2.39.5