From f08225136fc7f5ed055f8fb382cd7c5331ce93a2 Mon Sep 17 00:00:00 2001 From: Riyyi Date: Wed, 3 Aug 2022 11:47:54 +0200 Subject: [PATCH] Util: Fix stringToNumber in Format::Parser --- src/util/format/parser.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/util/format/parser.cpp b/src/util/format/parser.cpp index 6512433..943664f 100644 --- a/src/util/format/parser.cpp +++ b/src/util/format/parser.cpp @@ -147,10 +147,8 @@ size_t Parser::stringToNumber(std::string_view value) { size_t result = 0; - for (size_t i = 1; i < value.length(); ++i) { - if (value[i] < '0' || value[i] > '9') { - VERIFY_NOT_REACHED(); - } + for (size_t i = 0; i < value.length(); ++i) { + VERIFY(value[i] >= '0' && value[i] <= '9', "unexpected '%c'", value[i]); result *= 10; result += value[i] - '0'; // Subtract ASCII 48 to get the number }