1
0
mirror of https://github.com/etesync/android synced 2025-07-08 15:48:17 +00:00

Null-pointer check for SIP address types (fixes #506)

This commit is contained in:
Ricki Hirner 2015-07-18 00:52:44 +02:00
parent ad733ebff1
commit 92966a5c57

View File

@ -635,18 +635,19 @@ public class LocalAddressBook extends LocalCollection<Contact> {
protected void populateSipAddress(Contact c, ContentValues row) { protected void populateSipAddress(Contact c, ContentValues row) {
try { try {
Impp impp = new Impp("sip:" + row.getAsString(SipAddress.SIP_ADDRESS)); Impp impp = new Impp("sip:" + row.getAsString(SipAddress.SIP_ADDRESS));
switch (row.getAsInteger(SipAddress.TYPE)) { if (row.containsKey(SipAddress.TYPE))
case SipAddress.TYPE_HOME: switch (row.getAsInteger(SipAddress.TYPE)) {
impp.addType(ImppType.HOME); case SipAddress.TYPE_HOME:
break; impp.addType(ImppType.HOME);
case SipAddress.TYPE_WORK: break;
impp.addType(ImppType.WORK); case SipAddress.TYPE_WORK:
break; impp.addType(ImppType.WORK);
case SipAddress.TYPE_CUSTOM: break;
String customType = row.getAsString(SipAddress.LABEL); case SipAddress.TYPE_CUSTOM:
if (StringUtils.isNotEmpty(customType)) String customType = row.getAsString(SipAddress.LABEL);
impp.addType(ImppType.get(labelToXName(customType))); if (StringUtils.isNotEmpty(customType))
} impp.addType(ImppType.get(labelToXName(customType)));
}
c.getImpps().add(impp); c.getImpps().add(impp);
} catch(IllegalArgumentException e) { } catch(IllegalArgumentException e) {
Log.e(TAG, "Illegal SIP URI", e); Log.e(TAG, "Illegal SIP URI", e);