mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 13:08:46 +00:00
Prevent possible crash while reading contacts cursor.
This commit is contained in:
@@ -579,11 +579,11 @@ object SystemContactsRepository {
|
||||
}
|
||||
|
||||
override fun hasNext(): Boolean {
|
||||
return !cursor.isAfterLast
|
||||
return !cursor.isAfterLast && cursor.position >= 0
|
||||
}
|
||||
|
||||
override fun next(): ContactDetails {
|
||||
if (cursor.isAfterLast) {
|
||||
if (cursor.isAfterLast || cursor.position < 0) {
|
||||
throw NoSuchElementException()
|
||||
}
|
||||
|
||||
@@ -591,7 +591,7 @@ object SystemContactsRepository {
|
||||
val phoneDetails: List<ContactPhoneDetails> = readAllPhones(cursor, lookupKey)
|
||||
val structuredName: StructuredName? = readStructuredName(cursor, lookupKey)
|
||||
|
||||
while (!cursor.isAfterLast && cursor.getLookupKey() == lookupKey) {
|
||||
while (!cursor.isAfterLast && cursor.position >= 0 && cursor.getLookupKey() == lookupKey) {
|
||||
cursor.moveToNext()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user