Removed checks
This commit is contained in:
parent
67c3310772
commit
e39a2913f0
@ -225,7 +225,7 @@ FileId AnimationsManager::on_get_animation(unique_ptr<Animation> new_animation,
|
||||
const AnimationsManager::Animation *AnimationsManager::get_animation(FileId file_id) const {
|
||||
auto animation = animations_.find(file_id);
|
||||
if (animation == animations_.end()) {
|
||||
return Animation{};
|
||||
return make_unique<Animation>().get();
|
||||
}
|
||||
|
||||
CHECK(animation->second->file_id == file_id);
|
||||
|
@ -94,7 +94,7 @@ FileId AudiosManager::on_get_audio(unique_ptr<Audio> new_audio, bool replace) {
|
||||
const AudiosManager::Audio *AudiosManager::get_audio(FileId file_id) const {
|
||||
auto audio = audios_.find(file_id);
|
||||
if (audio == audios_.end()) {
|
||||
return Audio{};
|
||||
return make_unique<Audio>().get();
|
||||
}
|
||||
|
||||
CHECK(audio->second->file_id == file_id);
|
||||
|
@ -489,7 +489,7 @@ void DocumentsManager::create_document(FileId file_id, string minithumbnail, Pho
|
||||
const DocumentsManager::GeneralDocument *DocumentsManager::get_document(FileId file_id) const {
|
||||
auto document = documents_.find(file_id);
|
||||
if (document == documents_.end()) {
|
||||
return GeneralDocument{};
|
||||
return make_unique<GeneralDocument>().get();
|
||||
}
|
||||
|
||||
CHECK(document->second->file_id == file_id);
|
||||
|
@ -1607,7 +1607,7 @@ std::pair<int64, FileId> StickersManager::on_get_sticker_document(
|
||||
StickersManager::Sticker *StickersManager::get_sticker(FileId file_id) {
|
||||
auto sticker = stickers_.find(file_id);
|
||||
if (sticker == stickers_.end()) {
|
||||
return Sticker{};
|
||||
return make_unique<Sticker>().get();
|
||||
}
|
||||
|
||||
CHECK(sticker->second->file_id == file_id);
|
||||
@ -1627,7 +1627,7 @@ const StickersManager::Sticker *StickersManager::get_sticker(FileId file_id) con
|
||||
StickersManager::StickerSet *StickersManager::get_sticker_set(StickerSetId sticker_set_id) {
|
||||
auto sticker_set = sticker_sets_.find(sticker_set_id);
|
||||
if (sticker_set == sticker_sets_.end()) {
|
||||
return StickerSet{};
|
||||
return make_unique<StickerSet>().get();
|
||||
}
|
||||
|
||||
return sticker_set->second.get();
|
||||
|
@ -84,11 +84,11 @@ FileId VideoNotesManager::on_get_video_note(unique_ptr<VideoNote> new_video_note
|
||||
const VideoNotesManager::VideoNote *VideoNotesManager::get_video_note(FileId file_id) const {
|
||||
auto video_note = video_notes_.find(file_id);
|
||||
if (video_note == video_notes_.end()) {
|
||||
return VideoNote{};
|
||||
return make_unique<VideoNote>().get();
|
||||
}
|
||||
|
||||
if (video_note->second->file_id != file_id) {
|
||||
return VideoNote{};
|
||||
return make_unique<VideoNote>().get();
|
||||
}
|
||||
return video_note->second.get();
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ FileId VoiceNotesManager::on_get_voice_note(unique_ptr<VoiceNote> new_voice_note
|
||||
const VoiceNotesManager::VoiceNote *VoiceNotesManager::get_voice_note(FileId file_id) const {
|
||||
auto voice_note = voice_notes_.find(file_id);
|
||||
if (voice_note == voice_notes_.end()) {
|
||||
return VoiceNote{};
|
||||
return make_unique<VoiceNote>().get();
|
||||
}
|
||||
|
||||
CHECK(voice_note->second->file_id == file_id);
|
||||
|
Reference in New Issue
Block a user