Prevent crash

pull/209/head
M66B 2 years ago
parent 5a5450baf9
commit 6295f1cbaa

@ -1202,6 +1202,10 @@ public class FragmentCompose extends FragmentBase {
if (typed == null) if (typed == null)
return result; return result;
final Context context = getContext();
if (context == null)
return result;
String wildcard = "%" + typed + "%"; String wildcard = "%" + typed + "%";
Map<String, EntityContact> map = new HashMap<>(); Map<String, EntityContact> map = new HashMap<>();
@ -1219,7 +1223,7 @@ public class FragmentCompose extends FragmentBase {
.replace("?", "[?]") + .replace("?", "[?]") +
"*"; "*";
boolean contacts = Helper.hasPermission(getContext(), Manifest.permission.READ_CONTACTS); boolean contacts = Helper.hasPermission(context, Manifest.permission.READ_CONTACTS);
if (contacts) { if (contacts) {
try (Cursor cursor = resolver.query( try (Cursor cursor = resolver.query(
ContactsContract.CommonDataKinds.Email.CONTENT_URI, ContactsContract.CommonDataKinds.Email.CONTENT_URI,

Loading…
Cancel
Save