Let accounts without the emoticon account data to create emojis/stickers

This check worked for accounts that already had custom emojis, but if it
never had any added, m_images was never filled and the model would crash
when adding more.
This commit is contained in:
Joshua Goins
2023-06-08 15:11:17 -04:00
committed by Tobias Fella
parent c2580c1d2d
commit 5b23593fd2

View File

@@ -96,10 +96,10 @@ void AccountEmoticonModel::setConnection(Connection *connection)
void AccountEmoticonModel::reloadEmoticons() void AccountEmoticonModel::reloadEmoticons()
{ {
if (!m_connection->hasAccountData("im.ponies.user_emotes"_ls)) { QJsonObject json;
return; if (m_connection->hasAccountData("im.ponies.user_emotes"_ls)) {
json = m_connection->accountData("im.ponies.user_emotes"_ls)->contentJson();
} }
auto json = m_connection->accountData("im.ponies.user_emotes"_ls)->contentJson();
const auto &content = ImagePackEventContent(json); const auto &content = ImagePackEventContent(json);
beginResetModel(); beginResetModel();
m_images = content; m_images = content;