From 420942873a595415d09c9a48b9950c214e77008b Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sat, 29 Dec 2018 13:01:18 +0100 Subject: Fix display name: Check localpart (return) for null --- main/src/ui/util/helper.vala | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'main/src/ui') 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(); } } -- cgit v1.2.3-70-g09d2