Avoid possibility of walking outside a contact cursor.

fork-5.53.8
Greyson Parrelli 2021-03-13 11:50:10 -05:00
rodzic b4266b8575
commit ec07e4b233
1 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -334,7 +334,7 @@ public class DirectoryHelper {
Log.w(TAG, "Ignoring unexpected mime type: " + mimeType);
}
while (getLookupKey(cursor).equals(lookupKey) && isPhoneMimeType(getMimeType(cursor))) {
while (!cursor.isAfterLast() && getLookupKey(cursor).equals(lookupKey) && isPhoneMimeType(getMimeType(cursor))) {
String number = CursorUtil.requireString(cursor, ContactsContract.CommonDataKinds.Phone.NUMBER);
if (isValidContactNumber(number)) {
@ -359,7 +359,7 @@ public class DirectoryHelper {
cursor.moveToNext();
}
if (getLookupKey(cursor).equals(lookupKey)) {
if (!cursor.isAfterLast() && getLookupKey(cursor).equals(lookupKey)) {
if (isStructuredNameMimeType(getMimeType(cursor))) {
StructuredNameRecord.Builder builder = new StructuredNameRecord.Builder();