Source:
<code>private void handlePresenceChanged(org.jivesoftware.smack.packet.Presence presence) { String status = presence.getStatus(); String resource = null; XmppAddress xaddress = new XmppAddress(presence.getFrom()); Contact contact = mContactListManager.getContact(xaddress.getBareAddress()); Presence p = new Presence(parsePresence(presence), status, null, null, Presence.CLIENT_TYPE_DEFAULT); String[] presenceParts = presence.getFrom().split("/"); if (presenceParts.length > 1) p.setResource(presenceParts[1]); if (contact == null) { debug(TAG, "got presence updated for NEW user: " + presence.getFrom()); XmppAddress xAddr = new XmppAddress(presence.getFrom()); Roster roster = mConnection.getRoster(); RosterEntry rEntry = roster.getEntry(xAddr.getBareAddress()); <START> String name = rEntry.getName(); <END> if (name == null || name.length() == 0) name = xAddr.getUser(); contact = new Contact(xAddr,name); try { if (!mContactListManager.getDefaultContactList().containsContact(contact.getAddress())) { mContactListManager.getDefaultContactList().addExistingContact(contact); } } catch (ImException e) { debug(TAG,"unable to add new contact to default list: " + e.getLocalizedMessage()); } } else { debug(TAG, "Got presence update for EXISTING user: " + contact.getAddress().getBareAddress() + " presence:" + p.getStatus()); } contact.setPresence(p); Contact[] contacts = new Contact[] { contact }; mContactListManager.notifyContactsPresenceUpdated(contacts); PacketExtension pe = presence.getExtension("x", NameSpace.VCARD_TEMP_X_UPDATE); if (pe != null) { DefaultPacketExtension dpe = (DefaultPacketExtension)pe; String hash = dpe.getValue("photo"); if (hash != null) loadVCard(mContext.getContentResolver(),contact.getAddress().getAddress(),hash); } }</code><technical_language>This null here, e.g. notified presence</technical_language>

Target:
private void handlePresenceChanged(org.jivesoftware.smack.packet.Presence presence) { String status = presence.getStatus(); String resource = null; XmppAddress xaddress = new XmppAddress(presence.getFrom()); final Roster roster = mConnection.getRoster(); if (roster != null) presence = roster.getPresence(xaddress.getBareAddress()); Contact contact = mContactListManager.getContact(xaddress.getBareAddress()); Presence p = new Presence(parsePresence(presence), status, null, null, Presence.CLIENT_TYPE_DEFAULT); String[] presenceParts = presence.getFrom().split("/"); if (presenceParts.length > 1) p.setResource(presenceParts[1]); if (contact == null) { debug(TAG, "got presence updated for NEW user: " + presence.getFrom()); XmppAddress xAddr = new XmppAddress(presence.getFrom()); RosterEntry rEntry = roster.getEntry(xAddr.getBareAddress()); String name = null; if (rEntry != null) name = rEntry.getName(); if (name == null || name.length() == 0) name = xAddr.getUser(); contact = new Contact(xAddr,name); try { if (!mContactListManager.getDefaultContactList().containsContact(contact.getAddress())) { mContactListManager.getDefaultContactList().addExistingContact(contact); } } catch (ImException e) { debug(TAG,"unable to add new contact to default list: " + e.getLocalizedMessage()); } } else { debug(TAG, "Got presence update for EXISTING user: " + contact.getAddress().getBareAddress() + " presence:" + p.getStatus()); } contact.setPresence(p); Contact[] contacts = new Contact[] { contact }; mContactListManager.notifyContactsPresenceUpdated(contacts); PacketExtension pe = presence.getExtension("x", NameSpace.VCARD_TEMP_X_UPDATE); if (pe != null) { DefaultPacketExtension dpe = (DefaultPacketExtension)pe; String hash = dpe.getValue("photo"); if (hash != null) loadVCard(mContext.getContentResolver(),contact.getAddress().getAddress(),hash); } }