diff options
| author | Maxime Coste <mawww@kakoune.org> | 2018-08-04 11:10:19 +0100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2018-08-04 11:10:19 +0100 |
| commit | 472a5732e247df1063d2f184ba9b933506a68142 (patch) | |
| tree | 72c2bb618ec45b8cb2d3832e72e05cb50c833c8a /src/string_utils.cc | |
| parent | bf488338aae5c3d9dda69127a3d787e0b65608f8 (diff) | |
An empty string is not a valid number
Fixes #2284
Diffstat (limited to 'src/string_utils.cc')
| -rw-r--r-- | src/string_utils.cc | 2 |
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) |
