diff -up dwm-5.1/dwm.c dwm-5.1-patched_by_zuo/dwm.c --- dwm-5.1/dwm.c 2008-07-29 20:18:32.000000000 +0200 +++ dwm-5.1-patched_by_zuo/dwm.c 2008-08-22 02:56:19.000000000 +0200 @@ -1497,9 +1497,12 @@ togglefloating(const Arg *arg) { void toggletag(const Arg *arg) { + if(!sel) + return; + unsigned int mask = sel->tags ^ (arg->ui & TAGMASK); - if(sel && mask) { + if(mask) { sel->tags = mask; arrange(); }