Skip to content
Snippets Groups Projects
Commit e20171fe authored by Amin Bandali's avatar Amin Bandali
Browse files

pixbufmanipulator: use default letter avatar for corrupted avatars

For cases where GDK_IS_PIXBUF returns FALSE on an avatar, use one
created by the generateAvatar function as a fallback, to avoid
warnings and trying to show a corrupted avatar.

Change-Id: I87c88056c643666de1e77849ea77e7c749689744
parent c54176f9
Branches
No related tags found
No related merge requests found
......@@ -213,7 +213,16 @@ PixbufManipulator::conversationPhoto(const lrc::api::conversation::Info& convers
} else if (!contactPhoto.isEmpty()) {
QByteArray byteArray = contactPhoto.toUtf8();
QVariant photo = personPhoto(byteArray);
return QVariant::fromValue(scaleAndFrame(photo.value<std::shared_ptr<GdkPixbuf>>().get(), size, displayInformation, status, unreadMessages));
if (GDK_IS_PIXBUF(photo.value<std::shared_ptr<GdkPixbuf>>().get())) {
return QVariant::fromValue(scaleAndFrame(
photo.value<std::shared_ptr<GdkPixbuf>>().get(), size,
displayInformation, status, unreadMessages));
} else {
return QVariant::fromValue(scaleAndFrame(
generateAvatar(bestName.toStdString(),
"ring:" + contactInfo.profileInfo.uri.toStdString()).get(),
size, displayInformation, status, unreadMessages));
}
} else {
return QVariant::fromValue(scaleAndFrame(generateAvatar(bestName.toStdString(),
"ring:" + contactInfo.profileInfo.uri.toStdString()).get(), size, displayInformation, status, unreadMessages));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment