diff --git a/td/telegram/ClientJson.cpp b/td/telegram/ClientJson.cpp index 9e3cbc22..e5fd4432 100644 --- a/td/telegram/ClientJson.cpp +++ b/td/telegram/ClientJson.cpp @@ -24,12 +24,11 @@ Result ClientJson::to_request(Slice request) { if (json_value.type() != JsonValue::Type::Object) { return Status::Error("Expected an Object"); } - TRY_RESULT(extra_field, get_json_object_field(json_value.get_object(), "@extra", JsonValue::Type::Null, true)); std::uint64_t extra_id = extra_id_.fetch_add(1, std::memory_order_relaxed); - auto extra_str = json_encode(extra_field); - if (!extra_str.empty()) { + if (has_json_object_field(json_value.get_object(), "@extra")) { std::lock_guard guard(mutex_); - extra_[extra_id] = std::move(extra_str); + extra_[extra_id] = json_encode( + get_json_object_field(json_value.get_object(), "@extra", JsonValue::Type::Null).move_as_ok()); } td_api::object_ptr func;