JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
added ban() which takes care than a banned window is not banned again... (this reduce...
[dwm.git] / tag.c
diff --git a/tag.c b/tag.c
index 609ce9c..f9aef0b 100644 (file)
--- a/tag.c
+++ b/tag.c
@@ -1,4 +1,4 @@
-/* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
+/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
  * See LICENSE file for license details.
  */
 #include "dwm.h"
@@ -76,13 +76,13 @@ settags(Client *c, Client *trans) {
        unsigned int i, j;
        regmatch_t tmp;
        Bool matched = trans != NULL;
-       XClassHint ch;
+       XClassHint ch = { 0 };
 
-       if(matched) {
+       if(matched)
                for(i = 0; i < ntags; i++)
                        c->tags[i] = trans->tags[i];
-       }
-       else if(XGetClassHint(dpy, c->win, &ch)) {
+       else {
+               XGetClassHint(dpy, c->win, &ch);
                snprintf(prop, sizeof prop, "%s:%s:%s",
                                ch.res_class ? ch.res_class : "",
                                ch.res_name ? ch.res_name : "", c->name);
@@ -114,7 +114,8 @@ tag(Arg *arg) {
                return;
        for(i = 0; i < ntags; i++)
                sel->tags[i] = (arg->i == -1) ? True : False;
-       sel->tags[arg->i] = True;
+       if(arg->i >= 0 && arg->i < ntags)
+               sel->tags[arg->i] = True;
        arrange();
 }