commit a2e5856f22739a9056fa41789369948450cd7e36
parent 4d6e1b39e14666dd0738301fa0ac1ab246ac1070
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat, 25 Jun 2022 10:11:26 +0200
fix segfault after querying window with no children
Reported by Augusto Castelo <alpheratz99@protonmail.com>, thanks!
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lsw.c b/lsw.c
@@ -36,7 +36,7 @@ lsw(Window win) {
 	Window *wins, *w, dw;
 	XWindowAttributes wa;
 
-	if(!XQueryTree(dpy, win, &dw, &dw, &wins, &n))
+	if(!XQueryTree(dpy, win, &dw, &dw, &wins, &n) || !n)
 		return;
 	for(w = &wins[n-1]; w >= &wins[0]; w--)
 		if(XGetWindowAttributes(dpy, *w, &wa)