summaryrefslogtreecommitdiff
path: root/src/string.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/string.cc')
-rw-r--r--src/string.cc3
1 files changed, 3 insertions, 0 deletions
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<StringView> wrap_lines(StringView text, CharCount max_width)
{
+ if (max_width <= 0)
+ throw runtime_error("Invalid max width");
+
using Utf8It = utf8::iterator<const char*>;
Utf8It word_begin{text.begin()};
Utf8It word_end{word_begin};