Fix crash on missing pack description

This commit is contained in:
Nicolas Werner 2022-03-25 18:40:27 +01:00
parent 9bac429eae
commit 7256c70108
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
1 changed files with 4 additions and 2 deletions

View File

@ -3708,8 +3708,10 @@ Cache::getImagePacks(const std::string &room_id, std::optional<bool> stickers)
auto addPack = [&infos, stickers](const mtx::events::msc2545::ImagePack &pack, auto addPack = [&infos, stickers](const mtx::events::msc2545::ImagePack &pack,
const std::string &source_room, const std::string &source_room,
const std::string &state_key) { const std::string &state_key) {
bool pack_matches = !stickers.has_value() || bool pack_is_sticker = pack.pack ? pack.pack->is_sticker() : true;
(stickers.value() ? pack.pack->is_sticker() : pack.pack->is_emoji()); bool pack_is_emoji = pack.pack ? pack.pack->is_emoji() : true;
bool pack_matches =
!stickers.has_value() || (stickers.value() ? pack_is_sticker : pack_is_emoji);
ImagePackInfo info; ImagePackInfo info;
info.source_room = source_room; info.source_room = source_room;