catch some db query exceptions

This commit is contained in:
Daniel Gultsch 2015-08-25 11:12:10 +02:00
parent 7617a19280
commit 25c49d5e34

View file

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