Check sticker pointer before use.
This commit is contained in:
parent
5e70be9d36
commit
ed56a75b8a
@ -3173,6 +3173,7 @@ vector<FileId> StickersManager::get_stickers(string emoji, int32 limit, bool for
|
||||
auto prefer_animated = [this](FileId lhs, FileId rhs) {
|
||||
const Sticker *lhs_s = get_sticker(lhs);
|
||||
const Sticker *rhs_s = get_sticker(rhs);
|
||||
CHECK(lhs_s != nullptr && rhs_s != nullptr);
|
||||
return lhs_s->is_animated && !rhs_s->is_animated;
|
||||
};
|
||||
// std::stable_sort(prepend_sticker_ids.begin(), prepend_sticker_ids.begin() + recent_sticker_ids_[0].size(),
|
||||
@ -3183,6 +3184,7 @@ vector<FileId> StickersManager::get_stickers(string emoji, int32 limit, bool for
|
||||
LOG(INFO) << "Have " << recent_sticker_ids_[0] << " recent and " << favorite_sticker_ids_ << " favorite stickers";
|
||||
for (const auto &sticker_id : prepend_sticker_ids) {
|
||||
const Sticker *s = get_sticker(sticker_id);
|
||||
CHECK(s != nullptr);
|
||||
LOG(INFO) << "Have prepend sticker " << sticker_id << " from " << s->set_id;
|
||||
if (s->set_id.is_valid() && !td::contains(sets_to_load, s->set_id)) {
|
||||
const StickerSet *sticker_set = get_sticker_set(s->set_id);
|
||||
@ -3269,6 +3271,7 @@ vector<FileId> StickersManager::get_stickers(string emoji, int32 limit, bool for
|
||||
is_good = true;
|
||||
} else {
|
||||
const Sticker *s = get_sticker(sticker_id);
|
||||
CHECK(s != nullptr);
|
||||
if (remove_emoji_modifiers(s->alt) == emoji) {
|
||||
LOG(INFO) << "Found prepend sticker " << sticker_id << " main emoji matches";
|
||||
is_good = true;
|
||||
|
Loading…
Reference in New Issue
Block a user