ref: 721a991694830725add39465b9e63f492c4834ff
parent: 3510cb585c3efa876a78add5a42bf9c06f186b1f
author: Ali Gholami Rudi <ali@rudi.ir>
date: Fri Nov 29 13:22:06 EST 2019
fmt: prevent divide by zero when \n(.v is zero Reported by Dirk-Wilhelm Peters <peters@schwertfisch.de>.
--- a/fmt.c
+++ b/fmt.c
@@ -631,7 +631,7 @@
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 */