summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Klapetek <mklapetek@kde.org>2016-02-11 03:16:37 (GMT)
committerAlexandr Akulich <akulichalexander@gmail.com>2016-09-21 13:05:33 (GMT)
commit1a0b7e2843e15beb543fda4d954e50417f4a7228 (patch)
tree6c67632745234bca585f0dc7fac2736abdeee721
parent46e4a5b716bf3a0d69dc8e9dc41d6fcbd5ff7911 (diff)
[declarative] Guard against null stuff
Reviewed-by: Alexandr Akulich <akulichalexander@gmail.com>
-rw-r--r--KTp/Declarative/conversation.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/KTp/Declarative/conversation.cpp b/KTp/Declarative/conversation.cpp
index d162dd2..2742320 100644
--- a/KTp/Declarative/conversation.cpp
+++ b/KTp/Declarative/conversation.cpp
@@ -122,18 +122,22 @@ QString Conversation::title() const
if (d->isGroupChat) {
QString roomName = textChannel()->targetId();
return roomName.left(roomName.indexOf(QLatin1Char('@')));
- } else {
+ } else if (!d->targetContact.isNull()) {
return d->targetContact->alias();
}
+
+ return QString();
}
QIcon Conversation::presenceIcon() const
{
if (d->isGroupChat) {
return KTp::Presence(Tp::Presence::available()).icon();
- } else {
+ } else if (!d->targetContact.isNull()) {
return KTp::Presence(d->targetContact->presence()).icon();
}
+
+ return QIcon();
}
QIcon Conversation::avatar() const