From 2d0ccfc9b1a6cdc135c82cc19a6d6ebb4527d010 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Tue, 4 Jul 2023 01:53:55 -0400
Subject: [PATCH] Ensure we get at least one item before passing to the
 callback

Should fix ASan "crash".
---
 src/conio/x_events.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/conio/x_events.c b/src/conio/x_events.c
index e96a558544..13aa786935 100644
--- a/src/conio/x_events.c
+++ b/src/conio/x_events.c
@@ -1538,7 +1538,7 @@ net_wm_state_is_cb(bool (*cb)(Atom))
 				break;
 			}
 			ret = (Atom *)prop;
-			if (cb(*ret))
+			if (nir > 0 && cb(*ret))
 				is = true;
 			x11.XFree(prop);
 			if (is)
-- 
GitLab