summaryrefslogtreecommitdiff
path: root/src/string_utils.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2018-08-04 11:10:19 +0100
committerMaxime Coste <mawww@kakoune.org>2018-08-04 11:10:19 +0100
commit472a5732e247df1063d2f184ba9b933506a68142 (patch)
tree72c2bb618ec45b8cb2d3832e72e05cb50c833c8a /src/string_utils.cc
parentbf488338aae5c3d9dda69127a3d787e0b65608f8 (diff)
An empty string is not a valid number
Fixes #2284
Diffstat (limited to 'src/string_utils.cc')
-rw-r--r--src/string_utils.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/string_utils.cc b/src/string_utils.cc
index 742a3f19..0a420fec 100644
--- a/src/string_utils.cc
+++ b/src/string_utils.cc
@@ -100,6 +100,8 @@ Optional<int> str_to_int_ifp(StringView str)
bool negative = not str.empty() and str[0] == '-';
if (negative)
str = str.substr(1_byte);
+ if (str.empty())
+ return {};
unsigned int res = 0;
for (auto c : str)