Fixed unclosed cursor

This commit is contained in:
Doug Keen 2012-09-25 16:29:28 -07:00
parent f12860d87e
commit 281b7df3d3

View File

@ -230,10 +230,14 @@ public class BartContentProvider extends ContentProvider {
+ RoutesColumns.TO_STATION.string + "=?", + RoutesColumns.TO_STATION.string + "=?",
new String[] { origin, destination }, null, null, null); new String[] { origin, destination }, null, null, null);
if (query.moveToFirst()) { try {
return update(ContentUris.withAppendedId( if (query.moveToFirst()) {
Constants.FAVORITE_CONTENT_URI, query.getLong(0)), return update(ContentUris.withAppendedId(
values, where, whereArgs); Constants.FAVORITE_CONTENT_URI, query.getLong(0)),
values, where, whereArgs);
}
} finally {
CursorUtils.closeCursorQuietly(query);
} }
} }
return 0; return 0;