Skip to content
Snippets Groups Projects
Commit e054fc95 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

misc: fix missing account avatar

Change-Id: I69acb78e60e04f74382561e130185a1aca8064d6
parent 8305c0a0
No related branches found
No related tags found
No related merge requests found
......@@ -309,13 +309,15 @@ getAccountAvatar(const QString& accountId)
QString filePath;
filePath = accountLocalPath + "profile.vcf";
QFile file(filePath);
if (!file.open(QIODevice::ReadOnly))
if (!file.open(QIODevice::ReadOnly)) {
return {};
}
const auto vCard = lrc::vCard::utils::toHashMap(file.readAll());
const auto photo = (vCard.find(vCard::Property::PHOTO_PNG) == vCard.end())
? vCard[vCard::Property::PHOTO_JPEG]
: vCard[vCard::Property::PHOTO_PNG];
return photo;
for (const auto& key : vCard.keys()) {
if (key.contains("PHOTO"))
return vCard[key];
}
return {};
}
static QPair<QString, QString>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment