From 803a9ba98d6976c71e92973e3af6096476984fa3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
 <leohdz172@protonmail.com>
Date: Fri, 16 Dec 2022 16:31:31 -0600
Subject: Revert "Revert "Check that inhibitor scene tree is not null""

This reverts commit 035bb99d67b59a84cfc2e911d222fb597591a8be.

Not checking `tree != NULL` result in a segfault if the surface doesn't have a
role (for example because it is a newly created surface)

Closes: https://github.com/djpohly/dwl/issues/359
---
 dwl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dwl.c b/dwl.c
index 5add915..2bcb8b1 100644
--- a/dwl.c
+++ b/dwl.c
@@ -628,7 +628,7 @@ checkidleinhibitor(struct wlr_surface *exclude)
 		struct wlr_surface *surface = wlr_surface_get_root_surface(inhibitor->surface);
 		struct wlr_scene_tree *tree = surface->data;
 		if (bypass_surface_visibility || (exclude != surface
-				&& tree->node.enabled)) {
+				&& tree && tree->node.enabled)) {
 			inhibited = 1;
 			break;
 		}
-- 
cgit v1.2.3