Skip to content

Commit

Permalink
Fix UTF-8 encoding check of a string.
Browse files Browse the repository at this point in the history
  • Loading branch information
levlam committed Nov 15, 2023
1 parent efa6e20 commit 247c28d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tdutils/td/utils/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 247c28d

Please sign in to comment.