From 437cdabadfd6324f87ce367fdaf5aed9036e5ae0 Mon Sep 17 00:00:00 2001 From: daniel oeh Date: Sun, 10 Mar 2013 21:57:35 +0100 Subject: auto-cleanup deleted wrong number of episodes --- src/de/danoeh/antennapod/feed/FeedManager.java | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src') 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; + } } } } -- cgit v1.2.3