Skip to content

Commit

Permalink
fix database cursor leak in DataHelper class
Browse files Browse the repository at this point in the history
I moved the cursor closing code outside the if block to make sure the cursor is closed even when it is empty (when getCount() returns 0).
  • Loading branch information
andrew659 committed Oct 9, 2016
1 parent 63cac7e commit 9c162aa
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ public static File getTrackDirFromDB(ContentResolver cr, long trackId) {
if (trackPath != null) {
trackDir = new File(trackPath);
}
}
if (c != null && !c.isClosed()) {
c.close();
c = null;
}
Expand Down

0 comments on commit 9c162aa

Please sign in to comment.