catch some db query exceptions
This commit is contained in:
parent
7617a19280
commit
25c49d5e34
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue