fix pushup crash
@@ -17,10 +17,24 @@ prevc(Client *c, float f) {
return r;
}
+int clientcount()
+{
+ int count;
+ Client *c;
+ for(c = selmon->clients; c; c = c->next) {
+ if (ISVISIBLE(c))
+ count++;
+ }
+ return count;
+}
+
static void
pushup(const Arg *arg) {
Client *sel = selmon->sel;
Client *c;
+ if (clientcount() < 2) {
+ return;
+ }
if(!sel || (sel->isfloating && !arg->f))
return;
@@ -50,6 +64,10 @@ pushdown(const Arg *arg) {
Client *sel = selmon->sel;
Client *c;
+ if (clientcount() < 2) {
+ return;
+ }
+
if(!sel || (sel->isfloating && !arg->f))
return;
if((c = nextc(sel->next, arg->f))) {
