Skip to content

Commit

Permalink
More fixes with opened cursors
Browse files Browse the repository at this point in the history
  • Loading branch information
vicpinm authored Jun 12, 2018
1 parent 312700b commit 9945e34
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/com/activeandroid/rx/RxSelect.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public T call(SqlBrite.Query query) {
cursor.moveToFirst();
Model model = (Model) mType.newInstance();
model.loadFromCursor(cursor);
cursor.close();
return (T) model;
}
} catch (Exception ex) {
Expand Down Expand Up @@ -249,7 +250,9 @@ public Observable<Integer> count() {
@Override public Integer call(SqlBrite.Query query) {
Cursor cursor = query.run();
if (cursor.moveToFirst()) {
return cursor.getInt(cursor.getColumnIndex(cursor.getColumnName(0)));
int amount = cursor.getInt(cursor.getColumnIndex(cursor.getColumnName(0)));
cursor.close();
return amount;
}
return 0;
}
Expand Down

0 comments on commit 9945e34

Please sign in to comment.