Skip to content

Commit

Permalink
ignore exceptions when querying the contacts db for displaying the Qu…
Browse files Browse the repository at this point in the history
…ickContact button
  • Loading branch information
Sam Steele committed Apr 18, 2011
1 parent 5dfbfe7 commit a470b67
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/src/fm/last/android/widget/QuickContactProfileBubble.java
Expand Up @@ -70,10 +70,16 @@ private void setQuickContactId(long id) {
public void setUser(User user) {
super.setUser(user);

Cursor c = getContext().getContentResolver().query(ContactsContract.Data.CONTENT_URI, new String[] { ContactsContract.Data.CONTACT_ID },
Cursor c = null;

try {
c = getContext().getContentResolver().query(ContactsContract.Data.CONTENT_URI, new String[] { ContactsContract.Data.CONTACT_ID },
ContactsContract.Data.DATA1 + "=?" + " AND " + ContactsContract.Data.MIMETYPE + "='vnd.android.cursor.item/vnd.fm.last.android.profile'",
new String[] { user.getName() }, null);

} catch (Exception e) {
e.printStackTrace();
}

if (c != null && c.moveToNext()) {
setQuickContactId(c.getLong(0));
} else if(mUser != null && mUser.getImages().length > 0) {
Expand Down

0 comments on commit a470b67

Please sign in to comment.