From 472a5732e247df1063d2f184ba9b933506a68142 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 4 Aug 2018 11:10:19 +0100 Subject: [PATCH] An empty string is not a valid number Fixes #2284 --- src/string_utils.cc | 2 ++ 1 file changed, 2 insertions(+) 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 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)