diff --git a/src/org/linphone/ContactPickerActivityNew.java b/src/org/linphone/ContactPickerActivityNew.java index 3154e7345..d85a2c5aa 100644 --- a/src/org/linphone/ContactPickerActivityNew.java +++ b/src/org/linphone/ContactPickerActivityNew.java @@ -268,6 +268,10 @@ public class ContactPickerActivityNew extends AbstractContactPickerActivity { // Finally using phone number String normalizedNumber = PhoneNumberUtils.getStrippedReversed(username); + if (TextUtils.isEmpty(normalizedNumber)) { + // non phone username + return null; + } Uri lookupUri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(username)); projection = new String[]{PhoneLookup._ID, PhoneLookup.NUMBER}; c = resolver.query(lookupUri, projection, null, null, null); diff --git a/src/org/linphone/ContactPickerActivityOld.java b/src/org/linphone/ContactPickerActivityOld.java index 8581c20d6..e4be622cf 100644 --- a/src/org/linphone/ContactPickerActivityOld.java +++ b/src/org/linphone/ContactPickerActivityOld.java @@ -29,6 +29,7 @@ import android.provider.Contacts; import android.provider.Contacts.People; import android.provider.Contacts.Photos; import android.telephony.PhoneNumberUtils; +import android.text.TextUtils; @SuppressWarnings("deprecation") public class ContactPickerActivityOld extends Activity { @@ -120,6 +121,10 @@ public class ContactPickerActivityOld extends Activity { public static Uri findUriPictureOfContact(ContentResolver resolver, String username, String domain) { String normalizedNumber = PhoneNumberUtils.getStrippedReversed(username); + if (TextUtils.isEmpty(normalizedNumber)) { + // non phone username + return null; + } String[] projection = {Contacts.Phones.PERSON_ID}; String selection = Contacts.Phones.NUMBER_KEY + "=" + normalizedNumber; Cursor c = resolver.query(Contacts.Phones.CONTENT_URI, projection, selection, null, null);