avoid empty strings when figuring out display name

This commit is contained in:
Daniel Gultsch 2017-07-30 11:39:16 +02:00
parent d3194172c5
commit 01b207d44d

View file

@ -112,13 +112,13 @@ public class Contact implements ListItem, Blockable {
} }
public String getDisplayName() { public String getDisplayName() {
if (this.commonName != null && Config.X509_VERIFICATION) { if (Config.X509_VERIFICATION && this.commonName != null && !this.commonName.isEmpty()) {
return this.commonName; return this.commonName;
} else if (this.systemName != null) { } else if (this.systemName != null && !this.systemName.isEmpty()) {
return this.systemName; return this.systemName;
} else if (this.serverName != null) { } else if (this.serverName != null && !this.serverName.isEmpty()) {
return this.serverName; return this.serverName;
} else if (this.presenceName != null && mutualPresenceSubscription()) { } else if (this.presenceName != null && !this.presenceName.isEmpty() && mutualPresenceSubscription() ) {
return this.presenceName; return this.presenceName;
} else if (jid.hasLocalpart()) { } else if (jid.hasLocalpart()) {
return jid.getUnescapedLocalpart(); return jid.getUnescapedLocalpart();