From d05b06fda7241145c7ca48a1ba10e9a38ea687a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B8=D1=80=D0=B8=D0=BB=D0=BB=20=D0=93=D0=B0=D1=80?= =?UTF-8?q?=D0=B1=D0=B0=D1=80?= Date: Fri, 13 Sep 2024 17:19:03 +0300 Subject: [PATCH] Fix no number case in readIntText --- src/IO/ReadHelpers.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/IO/ReadHelpers.h b/src/IO/ReadHelpers.h index 05198361ca2..77e1310aa7a 100644 --- a/src/IO/ReadHelpers.h +++ b/src/IO/ReadHelpers.h @@ -470,13 +470,15 @@ ReturnType readIntTextImpl(T & x, ReadBuffer & buf) } end: - if (has_sign && !has_number) + if (!has_number) { - if constexpr (throw_exception) + if constexpr (!throw_exception) + return ReturnType(false); + if (has_sign) throw Exception(ErrorCodes::CANNOT_PARSE_NUMBER, "Cannot parse number with a sign character but without any numeric character"); - else - return ReturnType(false); + throw Exception(ErrorCodes::CANNOT_PARSE_NUMBER, + "Cannot parse number without any numeric character"); } x = res; if constexpr (is_signed_v)