Skip to content
Snippets Groups Projects
Commit 2309eda8 authored by Sébastien Blin's avatar Sébastien Blin Committed by Philippe Gorley
Browse files

pixbufmanipulator: fix crash when CM has no name


If the contactmethod doesn't have a name, we should use the id and don't
try to get the first letter.

Change-Id: I748dd89a1580e3ea7e416f50d88b2e04cfc750e0
Reviewed-by: default avatarPhilippe Gorley <philippe.gorley@savoirfairelinux.com>
parent c5e6837d
No related branches found
No related tags found
No related merge requests found
...@@ -44,7 +44,16 @@ PixbufManipulator::generateAvatar(const ContactMethod* cm) const ...@@ -44,7 +44,16 @@ PixbufManipulator::generateAvatar(const ContactMethod* cm) const
if (hashName.size() > 0) { if (hashName.size() > 0) {
cm_number = hashName.at(0); cm_number = hashName.at(0);
} }
// Get the letter to draw
if (!cm->bestName().isEmpty()) {
// Prioritize the name
letter = cm->bestName().toUpper().at(0); letter = cm->bestName().toUpper().at(0);
} else if (!cm->bestId().isEmpty()) {
// If the contact has no name, use the id
letter = cm->bestId().toUpper().at(0);
} else {
// R for ring is used
}
} }
bool ok; bool ok;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment