From 40335785aad5362b5ef0f2a377b28819c1435b19 Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Sat, 20 Dec 2014 15:21:03 +0100 Subject: don't include empty fingerprints in list of otrfingerprints --- src/main/java/eu/siacs/conversations/entities/Contact.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/main/java/eu/siacs/conversations/entities/Contact.java b/src/main/java/eu/siacs/conversations/entities/Contact.java index 6a6b41d66..1fb80b9b2 100644 --- a/src/main/java/eu/siacs/conversations/entities/Contact.java +++ b/src/main/java/eu/siacs/conversations/entities/Contact.java @@ -266,13 +266,15 @@ public class Contact implements ListItem { } public ArrayList getOtrFingerprints() { - ArrayList fingerprints = new ArrayList(); + final ArrayList fingerprints = new ArrayList(); try { if (this.keys.has("otr_fingerprints")) { - JSONArray prints = this.keys - .getJSONArray("otr_fingerprints"); + final JSONArray prints = this.keys.getJSONArray("otr_fingerprints"); for (int i = 0; i < prints.length(); ++i) { - fingerprints.add(prints.getString(i)); + final String print = prints.getString(i); + if (print != null && !print.isEmpty()) { + fingerprints.add(prints.getString(i)); + } } } } catch (final JSONException ignored) { -- cgit v1.2.3