Skip to content

Commit

Permalink
Catching other unknown URL exception.
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyr59h committed Apr 23, 2015
1 parent 5864710 commit 4347d57
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,17 @@ public static int[] getImageSize(Uri uri, Context context){

if (uri.toString().contains("content:")) {
String[] projection = new String[] { MediaStore.Images.Media._ID, MediaStore.Images.Media.DATA };
Cursor cur = context.getContentResolver().query(uri, projection, null, null, null);
if (cur != null) {
if (cur.moveToFirst()) {
Cursor cur = null;
try {
cur = context.getContentResolver().query(uri, projection, null, null, null);
if (cur != null && cur.moveToFirst()) {
int dataColumn = cur.getColumnIndex(MediaStore.Images.Media.DATA);
path = cur.getString(dataColumn);
}
cur.close();
} catch (IllegalStateException stateException) {
Log.d(ImageUtils.class.getName(), "IllegalStateException querying content:" + uri);
} finally {
SqlUtils.closeCursor(cur);
}
}

Expand Down

0 comments on commit 4347d57

Please sign in to comment.