tree_restore: Check croot

Related to #2414, #3156.
This commit is contained in:
Orestis Floros 2018-09-09 16:09:39 +03:00
parent 9dc4df81ea
commit a3dcee35f3
No known key found for this signature in database
GPG Key ID: E9AD9F32E401E38F
1 changed files with 4 additions and 0 deletions

View 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);