Ignore web remote locations instead of crash.

GitOrigin-RevId: 0ab5d749eeff28bc25befd6610038a7aa43206a5
This commit is contained in:
levlam 2020-03-24 01:12:23 +03:00
parent 2d9eb0c00b
commit 487cb20597
2 changed files with 8 additions and 3 deletions

View File

@ -605,7 +605,10 @@ int32 AnimationsManager::get_saved_animations_hash(const char *source) const {
CHECK(animation != nullptr); CHECK(animation != nullptr);
auto file_view = td_->file_manager_->get_file_view(animation_id); auto file_view = td_->file_manager_->get_file_view(animation_id);
CHECK(file_view.has_remote_location()); 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<uint64>(file_view.remote_location().get_id()); auto id = static_cast<uint64>(file_view.remote_location().get_id());
numbers.push_back(static_cast<uint32>(id >> 32)); numbers.push_back(static_cast<uint32>(id >> 32));
numbers.push_back(static_cast<uint32>(id & 0xFFFFFFFF)); numbers.push_back(static_cast<uint32>(id & 0xFFFFFFFF));

View File

@ -4214,8 +4214,10 @@ int32 StickersManager::get_recent_stickers_hash(const vector<FileId> &sticker_id
CHECK(sticker != nullptr); CHECK(sticker != nullptr);
auto file_view = td_->file_manager_->get_file_view(sticker_id); auto file_view = td_->file_manager_->get_file_view(sticker_id);
CHECK(file_view.has_remote_location()); CHECK(file_view.has_remote_location());
CHECK(file_view.remote_location().is_document()); if (!file_view.remote_location().is_document()) {
CHECK(!file_view.remote_location().is_web()); LOG(ERROR) << "Recent sticker remote location is not document: " << file_view.remote_location();
continue;
}
auto id = static_cast<uint64>(file_view.remote_location().get_id()); auto id = static_cast<uint64>(file_view.remote_location().get_id());
numbers.push_back(static_cast<uint32>(id >> 32)); numbers.push_back(static_cast<uint32>(id >> 32));
numbers.push_back(static_cast<uint32>(id & 0xFFFFFFFF)); numbers.push_back(static_cast<uint32>(id & 0xFFFFFFFF));