summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Young <consult.awy@gmail.com>2015-07-06 08:14:13 (GMT)
committerKevin Smith <git@kismith.co.uk>2015-08-13 08:05:42 (GMT)
commit9bf162922691c1f45813da6a21f2e274bfad3114 (patch)
tree2d7c49abc72ede17701c3300140718b1c3e81bcc /src/com/isode/stroke/serializer
parentaf3bb03053b9d83f4d38b31d66b292792206a327 (diff)
downloadstroke-9bf162922691c1f45813da6a21f2e274bfad3114.zip
stroke-9bf162922691c1f45813da6a21f2e274bfad3114.tar.bz2
VCard.getPhoto() to return null for absent photo.
Most of the time when VCard.getPhoto() is called it is only used to determine presence or absence of a photo. Thus, it makes no sense to allocate an empty ByteArray() just for this purpose. Return null instead, if absent. Change-Id: I3bae02ffbece5589c74c950bbb4c0db6c0376c76
Diffstat (limited to 'src/com/isode/stroke/serializer')
-rw-r--r--src/com/isode/stroke/serializer/payloadserializers/VCardSerializer.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/com/isode/stroke/serializer/payloadserializers/VCardSerializer.java b/src/com/isode/stroke/serializer/payloadserializers/VCardSerializer.java
index 9d460fa..9630d80 100644
--- a/src/com/isode/stroke/serializer/payloadserializers/VCardSerializer.java
+++ b/src/com/isode/stroke/serializer/payloadserializers/VCardSerializer.java
@@ -74,12 +74,12 @@ public class VCardSerializer extends GenericPayloadSerializer<VCard>{
if (vcard.getNickname() != null && !vcard.getNickname().isEmpty()) {
queryElement.addNode(new XMLElement("NICKNAME", "", vcard.getNickname()));
}
- if (vcard.getPhoto() != null && !vcard.getPhoto().isEmpty() || vcard.getPhotoType() != null && !vcard.getPhotoType().isEmpty()) {
+ if (vcard.getPhoto() != null || vcard.getPhotoType() != null && !vcard.getPhotoType().isEmpty()) {
XMLElement photoElement = new XMLElement("PHOTO");
if (vcard.getPhotoType() != null && !vcard.getPhotoType().isEmpty()) {
photoElement.addNode(new XMLElement("TYPE", "", vcard.getPhotoType()));
}
- if (vcard.getPhoto() != null && !vcard.getPhoto().isEmpty()) {
+ if (vcard.getPhoto() != null) {
photoElement.addNode(new XMLElement("BINVAL", "", Base64.encode(vcard.getPhoto())));
}
queryElement.addNode(photoElement);