Resave sticker set without stickers only if it has already been inited.

This commit is contained in:
levlam 2023-05-15 15:27:23 +03:00
parent 9b4de71f28
commit 9cd859d313
2 changed files with 3 additions and 2 deletions

View File

@ -5745,6 +5745,7 @@ void StickersManager::on_load_sticker_set_from_database(StickerSetId sticker_set
LOG(INFO) << "Successfully loaded " << sticker_set_id << " with" << (with_stickers ? "" : "out")
<< " stickers of size " << value.size() << " from database";
auto was_inited = sticker_set->is_inited_;
auto old_sticker_count = sticker_set->sticker_ids_.size();
{
@ -5771,7 +5772,7 @@ void StickersManager::on_load_sticker_set_from_database(StickerSetId sticker_set
"on_load_sticker_set_from_database 2");
}
if (with_stickers && old_sticker_count < get_max_featured_sticker_count(sticker_set->sticker_type_) &&
if (with_stickers && was_inited && old_sticker_count < get_max_featured_sticker_count(sticker_set->sticker_type_) &&
old_sticker_count < sticker_set->sticker_ids_.size()) {
sticker_set->need_save_to_database_ = true;
}

View File

@ -364,7 +364,7 @@ void StickersManager::parse_sticker_set(StickerSet *sticker_set, ParserT &parser
<< sticker_set->short_name_ << "\"";
sticker_set->is_changed_ = true;
}
if (sticker_set->sticker_count_ != sticker_count || sticker_set->hash_ != hash) {
if (sticker_set->is_loaded_ && (sticker_set->sticker_count_ != sticker_count || sticker_set->hash_ != hash)) {
sticker_set->is_loaded_ = false;
sticker_set->is_changed_ = true;
}