Commit 6c46d35a authored by Olivier SOLDANO's avatar Olivier SOLDANO Committed by Guillaume Roguez

Fix null pointer access in decorationRole

The validity on the contact method pointer was not checked
in the decorationRole getter in pixbufmanipulator,
hence sometimes leading to segfault.

Change-Id: I3b43381285511cae58f94d8023ca6ed3b76e85c7
Reviewed-by: Guillaume Roguez's avatarGuillaume Roguez <guillaume.roguez@savoirfairelinux.com>
parent 6c318897
......@@ -194,10 +194,16 @@ QVariant PixbufManipulator::decorationRole(const ContactMethod* cm)
QImage photo;
if (cm && cm->contact() && cm->contact()->photo().isValid())
photo = cm->contact()->photo().value<QImage>();
else
else if (cm){
photo = fallbackAvatar(imgSize_,
cm->uri().userinfo().at(0).toLatin1(),
cm->bestName().at(0).toUpper().toLatin1());
} else {
photo = fallbackAvatar(imgSize_,
QString("?").at(0).toLatin1(),
QString("?").at(0).toUpper().toLatin1());
}
return QVariant::fromValue(scaleAndFrame(photo, imgSize_));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment