From 247c28d6e771706c298fffa2606fac5857bc7e51 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 15 Nov 2023 13:44:29 +0300 Subject: [PATCH] Fix UTF-8 encoding check of a string. --- tdutils/td/utils/misc.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tdutils/td/utils/misc.cpp b/tdutils/td/utils/misc.cpp index 7cf7d3ff6..78331dc51 100644 --- a/tdutils/td/utils/misc.cpp +++ b/tdutils/td/utils/misc.cpp @@ -83,11 +83,11 @@ string oneline(Slice str) { namespace detail { Status get_to_integer_safe_error(Slice str) { - auto status = Status::Error(PSLICE() << "Can't parse \"" << str << "\" as an integer"); - if (!check_utf8(status.message())) { - status = Status::Error("Strings must be encoded in UTF-8"); + auto error_message = PSTRING() << "Can't parse as an integer string \"" << str << '"'; + if (!check_utf8(error_message)) { + return Status::Error("Strings must be encoded in UTF-8"); } - return status; + return Status::Error(error_message); } } // namespace detail