aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/util/helper.vala
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2018-12-29 13:01:18 +0100
committerfiaxh <git@lightrise.org>2018-12-29 13:15:35 +0100
commit420942873a595415d09c9a48b9950c214e77008b (patch)
tree8be090fd70357867603185d55d27b13b56add408 /main/src/ui/util/helper.vala
parente455a229933ab292fecd6eb38ee7b84304a8a1e4 (diff)
downloaddino-420942873a595415d09c9a48b9950c214e77008b.tar.gz
dino-420942873a595415d09c9a48b9950c214e77008b.zip
Fix display name: Check localpart (return) for null
Diffstat (limited to 'main/src/ui/util/helper.vala')
-rw-r--r--main/src/ui/util/helper.vala9
1 files changed, 7 insertions, 2 deletions
diff --git a/main/src/ui/util/helper.vala b/main/src/ui/util/helper.vala
index ecfe87a8..406a879e 100644
--- a/main/src/ui/util/helper.vala
+++ b/main/src/ui/util/helper.vala
@@ -79,7 +79,6 @@ public static string get_display_name(StreamInteractor stream_interactor, Jid ji
return builder.str;
}
}
- return jid.bare_jid.to_string();
} else if (stream_interactor.get_module(MucManager.IDENTITY).is_groupchat_occupant(jid, account)) {
return jid.resourcepart;
} else {
@@ -94,7 +93,13 @@ public static string get_display_name(StreamInteractor stream_interactor, Jid ji
if (roster_item != null && roster_item.name != null && roster_item.name != "") {
return roster_item.name;
}
- return fallback_to_localpart ? jid.localpart : jid.bare_jid.to_string();
+ }
+
+ // Fallback to bare_jid / localpart
+ if (fallback_to_localpart && jid.localpart != null) {
+ return jid.localpart;
+ } else {
+ return jid.bare_jid.to_string();
}
}