diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2010-02-03 22:24:35 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2010-02-03 22:24:35 +0000 |
commit | 0409cc47dccfaad02aa5f8c6e05f21f9e6244ecc (patch) | |
tree | a0d61c039edcd77d1a365412d6aa7897618860ae /usr.bin | |
parent | c1183f31fb01dbd99c57d519205445fbd0ddc1fe (diff) |
Fix divide by zero on small windows with main-* layouts.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tmux/layout-set.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/tmux/layout-set.c b/usr.bin/tmux/layout-set.c index f52a6728a6b..c30065a51b7 100644 --- a/usr.bin/tmux/layout-set.c +++ b/usr.bin/tmux/layout-set.c @@ -1,4 +1,4 @@ -/* $OpenBSD: layout-set.c,v 1.4 2009/12/03 22:50:10 nicm Exp $ */ +/* $OpenBSD: layout-set.c,v 1.5 2010/02/03 22:24:34 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -244,6 +244,8 @@ layout_set_main_h(struct window *w) /* How many rows and columns will be needed? */ columns = w->sx / (PANE_MINIMUM + 1); /* maximum columns */ + if (columns == 0) + columns = 1; rows = 1 + (n - 1) / columns; columns = 1 + (n - 1) / rows; width = w->sx / columns; @@ -353,6 +355,8 @@ layout_set_main_v(struct window *w) /* How many rows and columns will be needed? */ rows = w->sy / (PANE_MINIMUM + 1); /* maximum rows */ + if (rows == 0) + rows = 1; columns = 1 + (n - 1) / rows; rows = 1 + (n - 1) / columns; height = w->sy / rows; |