am 02ecc3f4: Fix ContactLoader IllegalArgumentException crash

* commit '02ecc3f456a2e9d9fc2713583d387b708ae458d9':
  Fix ContactLoader IllegalArgumentException crash
diff --git a/src/com/android/contacts/list/ContactBrowseListFragment.java b/src/com/android/contacts/list/ContactBrowseListFragment.java
index 855f923..2381ea5 100644
--- a/src/com/android/contacts/list/ContactBrowseListFragment.java
+++ b/src/com/android/contacts/list/ContactBrowseListFragment.java
@@ -126,6 +126,9 @@
 
                 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();
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index 1773bb7..aa10786 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -1915,9 +1915,13 @@
                     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());