--- a/layout.c Thu May 24 15:55:28 2007 +0200 +++ b/layout.c Thu May 24 16:25:09 2007 +0200 @@ -40,7 +40,7 @@ ny += i * mh; nw = mw - 2 * c->border; nh = mh; - if(i + 1 == nmaster) /* remainder */ + if(i + 1 == (n < nmaster ? n : nmaster)) /* remainder */ nh = wah - mh * i; nh -= 2 * c->border; }