1
0
mirror of https://github.com/etesync/android synced 2024-12-23 15:18:14 +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) {
try {
Impp impp = new Impp("sip:" + row.getAsString(SipAddress.SIP_ADDRESS));
switch (row.getAsInteger(SipAddress.TYPE)) {
case SipAddress.TYPE_HOME:
impp.addType(ImppType.HOME);
break;
case SipAddress.TYPE_WORK:
impp.addType(ImppType.WORK);
break;
case SipAddress.TYPE_CUSTOM:
String customType = row.getAsString(SipAddress.LABEL);
if (StringUtils.isNotEmpty(customType))
impp.addType(ImppType.get(labelToXName(customType)));
}
if (row.containsKey(SipAddress.TYPE))
switch (row.getAsInteger(SipAddress.TYPE)) {
case SipAddress.TYPE_HOME:
impp.addType(ImppType.HOME);
break;
case SipAddress.TYPE_WORK:
impp.addType(ImppType.WORK);
break;
case SipAddress.TYPE_CUSTOM:
String customType = row.getAsString(SipAddress.LABEL);
if (StringUtils.isNotEmpty(customType))
impp.addType(ImppType.get(labelToXName(customType)));
}
c.getImpps().add(impp);
} catch(IllegalArgumentException e) {
Log.e(TAG, "Illegal SIP URI", e);