Harden against undefined X Atoms

Fixes #589
This commit is contained in:
Benedikt Heine 2019-01-15 18:29:32 +01:00
parent fb29047679
commit 19c9a8e296

View File

@ -256,15 +256,19 @@ bool window_is_fullscreen(Window window)
if (result == Success) { if (result == Success) {
for(int i = 0; i < n_items; i++) { for(int i = 0; i < n_items; i++) {
char *atom = XGetAtomName(xctx.dpy, ((Atom*)prop_to_return)[i]); Atom atom = ((Atom*) prop_to_return)[i];
if (!atom)
continue;
if (atom) { char *s = XGetAtomName(xctx.dpy, atom);
if(STR_EQ("_NET_WM_STATE_FULLSCREEN", atom)) if (!s)
fs = true; continue;
XFree(atom);
if(fs) if (STR_EQ(s, "_NET_WM_STATE_FULLSCREEN"))
break; fs = true;
} XFree(s);
if (fs)
break;
} }
} }