Skip to content

Commit

Permalink
fmt: prevent divide by zero when \n(.v is zero
Browse files Browse the repository at this point in the history
Reported by Dirk-Wilhelm Peters <[email protected]>.
  • Loading branch information
aligrudi committed Nov 29, 2019
1 parent 3510cb5 commit 721a991
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ static int fmt_break(struct fmt *f, int end)
static int fmt_safelines(void)
{
int lnht = MAX(1, n_L) * n_v;
return (f_nexttrap() + lnht - 1) / lnht;
return n_v > 0 ? (f_nexttrap() + lnht - 1) / lnht : 1000;
}

/* fill the words collected in the buffer */
Expand Down

0 comments on commit 721a991

Please sign in to comment.