mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-02 19:10:11 +01:00
Prevent crash
This commit is contained in:
@@ -705,7 +705,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
||||
ContactsContract.Contacts.STARRED + " DESC" +
|
||||
", " + ContactsContract.Contacts.TIMES_CONTACTED + " DESC" +
|
||||
", " + ContactsContract.Contacts.LAST_TIME_CONTACTED + " DESC");
|
||||
while (cursor.moveToNext())
|
||||
while (cursor != null && cursor.moveToNext())
|
||||
try {
|
||||
long id = cursor.getLong(cursor.getColumnIndex(ContactsContract.RawContacts._ID));
|
||||
String name = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
|
||||
|
||||
@@ -656,7 +656,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
},
|
||||
ContactsContract.CommonDataKinds.Email.ADDRESS + " = ?",
|
||||
new String[]{email}, null);
|
||||
if (cursor.moveToNext()) {
|
||||
if (cursor != null && cursor.moveToNext()) {
|
||||
int colContactId = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Photo.CONTACT_ID);
|
||||
int colLookupKey = cursor.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY);
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ public abstract class DB extends RoomDatabase {
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
cursor = db.query(command, new Object[0]);
|
||||
if (cursor.moveToNext())
|
||||
if (cursor != null && cursor.moveToNext())
|
||||
return cursor.getString(0);
|
||||
else
|
||||
return null;
|
||||
|
||||
@@ -211,7 +211,7 @@ public class EntityMessage implements Serializable {
|
||||
},
|
||||
ContactsContract.CommonDataKinds.Email.ADDRESS + " = ?",
|
||||
new String[]{email}, null);
|
||||
if (cursor.moveToNext()) {
|
||||
if (cursor != null && cursor.moveToNext()) {
|
||||
int colContactId = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Photo.CONTACT_ID);
|
||||
int colLookupKey = cursor.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY);
|
||||
int colDisplayName = cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME);
|
||||
|
||||
@@ -643,7 +643,7 @@ public class ServiceSynchronize extends LifecycleService {
|
||||
ContactsContract.Contacts.LOOKUP_KEY
|
||||
},
|
||||
null, null, null);
|
||||
if (cursor.moveToNext()) {
|
||||
if (cursor != null && cursor.moveToNext()) {
|
||||
if (true || Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||
Uri uri = ContactsContract.Contacts.getLookupUri(
|
||||
cursor.getLong(cursor.getColumnIndex(ContactsContract.Contacts._ID)),
|
||||
|
||||
Reference in New Issue
Block a user