catch some db query exceptions

This commit is contained in:
Daniel Gultsch 2015-08-25 11:12:10 +02:00
parent 7617a19280
commit 25c49d5e34
1 changed files with 5 additions and 3 deletions

View File

@ -104,15 +104,17 @@ public class FileUtils {
};
try {
cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,
null);
cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,null);
if (cursor != null && cursor.moveToFirst()) {
final int column_index = cursor.getColumnIndexOrThrow(column);
return cursor.getString(column_index);
}
} catch(Exception e) {
return null;
} finally {
if (cursor != null)
if (cursor != null) {
cursor.close();
}
}
return null;
}