1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-01 16:32:54 +03:00

An empty string is not a valid number

Fixes #2284
This commit is contained in:
Maxime Coste 2018-08-04 11:10:19 +01:00
parent bf488338aa
commit 472a5732e2

View File

@ -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)