mirror of
https://github.com/moparisthebest/davmail
synced 2025-01-07 03:38:05 -05:00
Carddav: avoid NullPointerException on broken contact
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1893 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
8f9465ab46
commit
763a0e49ed
@ -1742,21 +1742,20 @@ public class EwsExchangeSession extends ExchangeSession {
|
|||||||
EWSMethod.Item item = getItemMethod.getResponseItem();
|
EWSMethod.Item item = getItemMethod.getResponseItem();
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
FileAttachment attachment = item.getAttachmentByName("ContactPicture.jpg");
|
FileAttachment attachment = item.getAttachmentByName("ContactPicture.jpg");
|
||||||
if (attachment != null) {
|
if (attachment == null) {
|
||||||
// get attachment content
|
throw new IOException("Missing contact picture");
|
||||||
GetAttachmentMethod getAttachmentMethod = new GetAttachmentMethod(attachment.attachmentId);
|
|
||||||
executeMethod(getAttachmentMethod);
|
|
||||||
|
|
||||||
contactPhoto = new ContactPhoto();
|
|
||||||
contactPhoto.content = getAttachmentMethod.getResponseItem().get("Content");
|
|
||||||
if (attachment.contentType == null) {
|
|
||||||
contactPhoto.contentType = "image/jpeg";
|
|
||||||
} else {
|
|
||||||
contactPhoto.contentType = attachment.contentType;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// get attachment content
|
||||||
|
GetAttachmentMethod getAttachmentMethod = new GetAttachmentMethod(attachment.attachmentId);
|
||||||
|
executeMethod(getAttachmentMethod);
|
||||||
|
|
||||||
|
contactPhoto = new ContactPhoto();
|
||||||
|
contactPhoto.content = getAttachmentMethod.getResponseItem().get("Content");
|
||||||
|
if (attachment.contentType == null) {
|
||||||
|
contactPhoto.contentType = "image/jpeg";
|
||||||
|
} else {
|
||||||
|
contactPhoto.contentType = attachment.contentType;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return contactPhoto;
|
return contactPhoto;
|
||||||
|
Loading…
Reference in New Issue
Block a user