don't include empty fingerprints in list of otrfingerprints

This commit is contained in:
iNPUTmice 2014-12-20 15:21:03 +01:00
parent 6b047bed97
commit 40335785aa

View file

@ -266,15 +266,17 @@ public class Contact implements ListItem {
} }
public ArrayList<String> getOtrFingerprints() { public ArrayList<String> getOtrFingerprints() {
ArrayList<String> fingerprints = new ArrayList<String>(); final ArrayList<String> fingerprints = new ArrayList<String>();
try { try {
if (this.keys.has("otr_fingerprints")) { if (this.keys.has("otr_fingerprints")) {
JSONArray prints = this.keys final JSONArray prints = this.keys.getJSONArray("otr_fingerprints");
.getJSONArray("otr_fingerprints");
for (int i = 0; i < prints.length(); ++i) { for (int i = 0; i < prints.length(); ++i) {
final String print = prints.getString(i);
if (print != null && !print.isEmpty()) {
fingerprints.add(prints.getString(i)); fingerprints.add(prints.getString(i));
} }
} }
}
} catch (final JSONException ignored) { } catch (final JSONException ignored) {
} }