Fix crash for call log item without number
This commit is contained in:
parent
535680196c
commit
f932e391af
|
@ -5,6 +5,7 @@ import android.content.Context;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.provider.ContactsContract;
|
import android.provider.ContactsContract;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
public class ContactsHelper {
|
public class ContactsHelper {
|
||||||
|
|
||||||
|
@ -13,6 +14,8 @@ public class ContactsHelper {
|
||||||
};
|
};
|
||||||
|
|
||||||
public static String getContactName(Context context, String number) {
|
public static String getContactName(Context context, String number) {
|
||||||
|
if (TextUtils.isEmpty(number)) return null;
|
||||||
|
|
||||||
Uri uri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI,
|
Uri uri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI,
|
||||||
Uri.encode(number));
|
Uri.encode(number));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue