From eaedf7026248b353409a1da6bed201fc0e8ff3bc Mon Sep 17 00:00:00 2001 From: Ivan Kanakarakis Date: Mon, 9 Jul 2012 22:36:13 +0300 Subject: rework change_desktop function - check bounds --- monsterwm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monsterwm.c b/monsterwm.c index bbee69c..8fbf554 100644 --- a/monsterwm.c +++ b/monsterwm.c @@ -213,7 +213,7 @@ void buttonpress(XEvent *e) { * then unmap the old windows * first all others then the current */ void change_desktop(const Arg *arg) { - if (arg->i == currdeskidx) return; + if (arg->i == currdeskidx || arg->i < 0 || arg->i >= DESKTOPS) return; Desktop *d = &desktops[currdeskidx], *n = &desktops[(currdeskidx = arg->i)]; if (n->curr) XMapWindow(dis, n->curr->win); for (Client *c = n->head; c; c = c->next) XMapWindow(dis, c->win); -- cgit v1.3.1