diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2013-03-10 21:57:35 +0100 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2013-03-10 21:57:35 +0100 |
commit | 437cdabadfd6324f87ce367fdaf5aed9036e5ae0 (patch) | |
tree | 918bc3d115bad787303d0fc1c3a180c00b8903b6 /src | |
parent | ceeb4c96120d640828f6b30ce605d297d0a93d46 (diff) | |
download | AntennaPod-437cdabadfd6324f87ce367fdaf5aed9036e5ae0.zip |
auto-cleanup deleted wrong number of episodes
Diffstat (limited to 'src')
-rw-r--r-- | src/de/danoeh/antennapod/feed/FeedManager.java | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/de/danoeh/antennapod/feed/FeedManager.java b/src/de/danoeh/antennapod/feed/FeedManager.java index e558b34ff..51d8e194f 100644 --- a/src/de/danoeh/antennapod/feed/FeedManager.java +++ b/src/de/danoeh/antennapod/feed/FeedManager.java @@ -714,16 +714,18 @@ public class FeedManager { * */ private int performAutoCleanup(Context context, final int episodeNumber) { int counter = 0; - int episodesLeft = episodeNumber; - feedloop: for (Feed feed : feeds) { - for (FeedItem item : feed.getItems()) { - if (item.hasMedia() && item.getMedia().isDownloaded()) { - if (!isInQueue(item) && item.isRead()) { - deleteFeedMedia(context, item.getMedia()); - counter++; - episodesLeft--; - if (episodesLeft == 0) { - break feedloop; + if (episodeNumber > 0) { + int episodesLeft = episodeNumber; + feedloop: for (Feed feed : feeds) { + for (FeedItem item : feed.getItems()) { + if (item.hasMedia() && item.getMedia().isDownloaded()) { + if (!isInQueue(item) && item.isRead()) { + deleteFeedMedia(context, item.getMedia()); + counter++; + episodesLeft--; + if (episodesLeft == 0) { + break feedloop; + } } } } |