From 487cb2059783b00af402d5edf140a309b7daa986 Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 24 Mar 2020 01:12:23 +0300 Subject: [PATCH] Ignore web remote locations instead of crash. GitOrigin-RevId: 0ab5d749eeff28bc25befd6610038a7aa43206a5 --- td/telegram/AnimationsManager.cpp | 5 ++++- td/telegram/StickersManager.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/td/telegram/AnimationsManager.cpp b/td/telegram/AnimationsManager.cpp index 9316fff1..467d9de3 100644 --- a/td/telegram/AnimationsManager.cpp +++ b/td/telegram/AnimationsManager.cpp @@ -605,7 +605,10 @@ int32 AnimationsManager::get_saved_animations_hash(const char *source) const { CHECK(animation != nullptr); auto file_view = td_->file_manager_->get_file_view(animation_id); CHECK(file_view.has_remote_location()); - LOG_CHECK(file_view.remote_location().is_document()) << source << " " << file_view.remote_location(); + if (!file_view.remote_location().is_document()) { + LOG(ERROR) << "Saved animation remote location is not document: " << source << " " << file_view.remote_location(); + continue; + } auto id = static_cast(file_view.remote_location().get_id()); numbers.push_back(static_cast(id >> 32)); numbers.push_back(static_cast(id & 0xFFFFFFFF)); diff --git a/td/telegram/StickersManager.cpp b/td/telegram/StickersManager.cpp index f47d3200..0c5a54cf 100644 --- a/td/telegram/StickersManager.cpp +++ b/td/telegram/StickersManager.cpp @@ -4214,8 +4214,10 @@ int32 StickersManager::get_recent_stickers_hash(const vector &sticker_id CHECK(sticker != nullptr); auto file_view = td_->file_manager_->get_file_view(sticker_id); CHECK(file_view.has_remote_location()); - CHECK(file_view.remote_location().is_document()); - CHECK(!file_view.remote_location().is_web()); + if (!file_view.remote_location().is_document()) { + LOG(ERROR) << "Recent sticker remote location is not document: " << file_view.remote_location(); + continue; + } auto id = static_cast(file_view.remote_location().get_id()); numbers.push_back(static_cast(id >> 32)); numbers.push_back(static_cast(id & 0xFFFFFFFF));