aboutsummaryrefslogtreecommitdiffstats
path: root/linein.c
diff options
context:
space:
mode:
authorDavid Crosby <dave@dafyddcrosby.com>2015-07-10 02:11:38 +0000
committerTatsuya Kinoshita <tats@debian.org>2015-08-11 12:59:27 +0000
commitdba9fe97530e027be539cfc9022f88aab52517d3 (patch)
treebac8b2e679f092b10a97585ceded06deead26be2 /linein.c
parentChange total_dot_number to unsigned int (diff)
downloadw3m-dba9fe97530e027be539cfc9022f88aab52517d3.tar.gz
w3m-dba9fe97530e027be539cfc9022f88aab52517d3.zip
Fix a divide-by-zero
Diffstat (limited to 'linein.c')
-rw-r--r--linein.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/linein.c b/linein.c
index 572b015..d8f9023 100644
--- a/linein.c
+++ b/linein.c
@@ -714,7 +714,8 @@ _rdcompl(void)
static void
next_dcompl(int next)
{
- static int col, row, len;
+ static int col, row;
+ static unsigned int len;
static Str d;
int i, j, n, y;
Str f;
@@ -780,9 +781,10 @@ next_dcompl(int next)
if (len < n)
len = n;
}
- col = COLS / len;
- if (col == 0)
- col = 1;
+ if (len > 0 && COLS > len)
+ col = COLS / len;
+ else
+ col = 1;
row = (NCFileBuf + col - 1) / col;
disp_next: