need to close the image cursor

This commit is contained in:
Tom Hennen 2015-11-07 09:30:20 -05:00
parent 0aeb520f14
commit baa2d6910d
1 changed files with 9 additions and 6 deletions

View File

@ -849,13 +849,16 @@ public final class DBReader {
*/
static FeedImage getFeedImage(PodDBAdapter adapter, final long id) {
Cursor cursor = adapter.getImageCursor(id);
if ((cursor.getCount() == 0) || !cursor.moveToFirst()) {
return null;
try {
if ((cursor.getCount() == 0) || !cursor.moveToFirst()) {
return null;
}
FeedImage image = FeedImage.fromCursor(cursor);
image.setId(id);
return image;
} finally {
cursor.close();
}
FeedImage image = FeedImage.fromCursor(cursor);
image.setId(id);
cursor.close();
return image;
}
/**