diff options
Diffstat (limited to 'src/com/isode/stroke/vcards')
-rw-r--r-- | src/com/isode/stroke/vcards/VCardStorage.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/com/isode/stroke/vcards/VCardStorage.java b/src/com/isode/stroke/vcards/VCardStorage.java index cb732ea..5ac095c 100644 --- a/src/com/isode/stroke/vcards/VCardStorage.java +++ b/src/com/isode/stroke/vcards/VCardStorage.java @@ -4,6 +4,7 @@ */ package com.isode.stroke.vcards; +import com.isode.stroke.base.ByteArray; import com.isode.stroke.crypto.CryptoProvider; import com.isode.stroke.elements.VCard; import com.isode.stroke.jid.JID; @@ -24,12 +25,13 @@ public abstract class VCardStorage { public void delete() {}; public String getPhotoHash(final JID jid) { - VCard vCard = getVCard(jid); - if (vCard != null && vCard.getPhoto().getSize() != 0) { - return Hexify.hexify(crypto.getSHA1Hash(vCard.getPhoto())); - } - else { - return ""; + final VCard vCard = getVCard(jid); + if (vCard != null) { + final ByteArray photo = vCard.getPhoto(); + if (photo != null) { + return Hexify.hexify(crypto.getSHA1Hash(photo)); + } } + return ""; } } |