Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 02ecc3f4 authored by Jay Shrauner's avatar Jay Shrauner
Browse files

Fix ContactLoader IllegalArgumentException crash

Display toast instead of crashing when unable to load contact due to
acore crash or invalid URI.

Bug: 18689131
Change-Id: I0e393e833bbb839af08ba6f4c10203a7d9abd3d7
parent 6de101d0
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -126,6 +126,9 @@ public abstract class ContactBrowseListFragment extends

                Log.e(TAG, "Error: No contact ID or lookup key for contact " + mUri);
                return null;
            } catch (Exception e) {
                Log.e(TAG, "Error loading the contact: " + mUri, e);
                return null;
            } finally {
                if (cursor != null) {
                    cursor.close();
+7 −3
Original line number Diff line number Diff line
@@ -1915,9 +1915,13 @@ public class QuickContactActivity extends ContactsActivity {
                    return;
                }
                if (data.isError()) {
                    // This shouldn't ever happen, so throw an exception. The {@link ContactLoader}
                    // should log the actual exception.
                    throw new IllegalStateException("Failed to load contact", data.getException());
                    // This means either the contact is invalid or we had an
                    // internal error such as an acore crash.
                    Log.i(TAG, "Failed to load contact: " + ((ContactLoader)loader).getLookupUri());
                    Toast.makeText(QuickContactActivity.this, R.string.invalidContactMessage,
                            Toast.LENGTH_LONG).show();
                    finish();
                    return;
                }
                if (data.isNotFound()) {
                    Log.i(TAG, "No contact found: " + ((ContactLoader)loader).getLookupUri());