diff --git a/ewmh.c b/ewmh.c index 8c121f94c..0de106a0e 100644 --- a/ewmh.c +++ b/ewmh.c @@ -529,7 +529,7 @@ ewmh_client_check_hints(client_t *c) desktop = *(uint32_t *) data; if(desktop == -1) c->sticky = true; - else + else if (desktop >= 0 && desktop < tags->len) for(int i = 0; i < tags->len; i++) if(desktop == i) { @@ -538,6 +538,13 @@ ewmh_client_check_hints(client_t *c) } else untag_client(c, tags->tab[i]); + else + /* Value out of bounds, just give it the first tag */ + if (tags->len > 0) + { + luaA_object_push(globalconf.L, tags->tab[0]); + tag_client(c); + } } p_delete(&reply);