From 29b508a894f565afbfdb4f170fe0bce80525bd58 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 7 Sep 2015 23:29:01 +0100 Subject: Avoid wrapping lines with negative max width --- src/string.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/string.cc') diff --git a/src/string.cc b/src/string.cc index 682a6947..45264898 100644 --- a/src/string.cc +++ b/src/string.cc @@ -218,6 +218,9 @@ String expand_tabs(StringView line, CharCount tabstop, CharCount col) Vector wrap_lines(StringView text, CharCount max_width) { + if (max_width <= 0) + throw runtime_error("Invalid max width"); + using Utf8It = utf8::iterator; Utf8It word_begin{text.begin()}; Utf8It word_end{word_begin}; -- cgit v1.2.3