Index: group.c =================================================================== RCS file: /cvs/xenocara/app/cwm/group.c,v retrieving revision 1.121 diff -u -r1.121 group.c --- group.c 10 Nov 2015 20:05:33 -0000 1.121 +++ group.c 25 Nov 2015 16:36:02 -0000 @@ -152,19 +152,21 @@ group_movetogroup(struct client_ctx *cc, int idx) { struct screen_ctx *sc = cc->sc; - struct group_ctx *gc; + struct group_ctx *gc = NULL; if (idx < 0 || idx >= CALMWM_NGROUPS) errx(1, "group_movetogroup: index out of range (%d)", idx); - TAILQ_FOREACH(gc, &sc->groupq, entry) { - if (gc->num == idx) - break; + if (idx != 0) { + TAILQ_FOREACH(gc, &sc->groupq, entry) { + if (gc->num == idx) + break; + } } if (cc->gc == gc) return; - if (group_holds_only_hidden(gc)) + if (gc != NULL && group_holds_only_hidden(gc)) client_hide(cc); group_assign(gc, cc); }