Prevent crash

pull/147/head
M66B 6 years ago
parent 9770fe009a
commit 84d09a381c

@ -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)),

Loading…
Cancel
Save