mirror of https://github.com/0intro/wmii
Make sure a window has a visual before dereferencing it. Fixes issue #195.
This commit is contained in:
parent
0855f12de8
commit
2177aed027
|
@ -7,7 +7,7 @@ ulong
|
||||||
pixelvalue(Window *w, Color *c) {
|
pixelvalue(Window *w, Color *c) {
|
||||||
XColor xc;
|
XColor xc;
|
||||||
|
|
||||||
if(w->visual->class != TrueColor) {
|
if(w->visual == nil || w->visual->class != TrueColor) {
|
||||||
if(c->pixel != ~0UL)
|
if(c->pixel != ~0UL)
|
||||||
return c->pixel;
|
return c->pixel;
|
||||||
xc.red = c->red;
|
xc.red = c->red;
|
||||||
|
|
|
@ -68,6 +68,7 @@ initdisplay(void) {
|
||||||
scr.depth = DefaultDepth(display, scr.screen);
|
scr.depth = DefaultDepth(display, scr.screen);
|
||||||
|
|
||||||
scr.root.xid = RootWindow(display, scr.screen);
|
scr.root.xid = RootWindow(display, scr.screen);
|
||||||
|
scr.root.visual = scr.visual;
|
||||||
scr.root.r = Rect(0, 0,
|
scr.root.r = Rect(0, 0,
|
||||||
DisplayWidth(display, scr.screen),
|
DisplayWidth(display, scr.screen),
|
||||||
DisplayHeight(display, scr.screen));
|
DisplayHeight(display, scr.screen));
|
||||||
|
|
Loading…
Reference in New Issue