Skip to content
Browse files

fix Common.isClicked() for manually revoked browser permissions

  • Loading branch information...
1 parent 769cb05 commit 4abce1a1e19d75e75e9ce0a9fa1acdf9e0b21c36 @talklittle committed Jan 11, 2012
Showing with 14 additions and 7 deletions.
  1. +14 −7 src/com/andrewshu/android/reddit/common/Common.java
View
21 src/com/andrewshu/android/reddit/common/Common.java
@@ -504,13 +504,20 @@ public static void launchBrowser(Context context, String url, String threadUrl,
}
public static boolean isClicked(Context context, String url) {
- Cursor cursor = context.getContentResolver().query(
- Browser.BOOKMARKS_URI,
- Browser.HISTORY_PROJECTION,
- Browser.HISTORY_PROJECTION[Browser.HISTORY_PROJECTION_URL_INDEX] + "=?",
- new String[]{ url },
- null
- );
+ Cursor cursor;
+ try {
+ cursor = context.getContentResolver().query(
+ Browser.BOOKMARKS_URI,
+ Browser.HISTORY_PROJECTION,
+ Browser.HISTORY_PROJECTION[Browser.HISTORY_PROJECTION_URL_INDEX] + "=?",
+ new String[]{ url },
+ null
+ );
+ } catch (Exception ex) {
+ if (Constants.LOGGING) Log.w(TAG, "Error querying Android Browser for history; manually revoked permission?", ex);
+ return false;
+ }
+
if (cursor != null) {
boolean isClicked = cursor.moveToFirst(); // returns true if cursor is not empty
cursor.close();

0 comments on commit 4abce1a

Please sign in to comment.
Something went wrong with that request. Please try again.