}
if (avatar == null) {
// If there's no avatar for that user, create an empty avatar and load it.
avatar = new byte[0];
hash = "";
VCardManager vCardManager = xmppSession.getExtensionManager(VCardManager.class);
// Load the vCard for that user
VCard vCard;
if (contact.equals(xmppSession.getConnectedResource().asBareJid())) {
vCard = vCardManager.getVCard();
} else {
vCard = vCardManager.getVCard(contact);
}
if (vCard != null) {
// And check if it has a photo.
VCard.Image image = vCard.getPhoto();
if (image != null && image.getValue() != null) {