From 01b207d44d7508fd0e9baacac8fcdb83a63f1554 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 30 Jul 2017 11:39:16 +0200 Subject: [PATCH] avoid empty strings when figuring out display name --- .../java/eu/siacs/conversations/entities/Contact.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/entities/Contact.java b/src/main/java/eu/siacs/conversations/entities/Contact.java index 76670faff..e182a9331 100644 --- a/src/main/java/eu/siacs/conversations/entities/Contact.java +++ b/src/main/java/eu/siacs/conversations/entities/Contact.java @@ -112,13 +112,13 @@ public class Contact implements ListItem, Blockable { } public String getDisplayName() { - if (this.commonName != null && Config.X509_VERIFICATION) { + if (Config.X509_VERIFICATION && this.commonName != null && !this.commonName.isEmpty()) { return this.commonName; - } else if (this.systemName != null) { + } else if (this.systemName != null && !this.systemName.isEmpty()) { return this.systemName; - } else if (this.serverName != null) { + } else if (this.serverName != null && !this.serverName.isEmpty()) { return this.serverName; - } else if (this.presenceName != null && mutualPresenceSubscription()) { + } else if (this.presenceName != null && !this.presenceName.isEmpty() && mutualPresenceSubscription() ) { return this.presenceName; } else if (jid.hasLocalpart()) { return jid.getUnescapedLocalpart();