diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2023-03-06 21:41:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-06 21:41:05 +0100 |
commit | 95b97b6f49e96c659c2ef09a81c93b040a99f888 (patch) | |
tree | ced326dc7d38d40f8d6bd5cd0a2af6322cf0ce94 /core/src/main | |
parent | 24d1a06662c8eec31f3a4c3ebdcd3aea759fb63a (diff) | |
download | AntennaPod-95b97b6f49e96c659c2ef09a81c93b040a99f888.zip |
Warn when local folder is empty instead of silently ignoring (#6366)
Diffstat (limited to 'core/src/main')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/feed/LocalFeedUpdater.java | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/LocalFeedUpdater.java b/core/src/main/java/de/danoeh/antennapod/core/feed/LocalFeedUpdater.java index 058602fdd..3db4bf2ab 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/LocalFeedUpdater.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/LocalFeedUpdater.java @@ -77,7 +77,7 @@ public class LocalFeedUpdater { @VisibleForTesting static void tryUpdateFeed(Feed feed, Context context, Uri folderUri, - UpdaterProgressListener updaterProgressListener) { + UpdaterProgressListener updaterProgressListener) throws IOException { if (feed.getItems() == null) { feed.setItems(new ArrayList<>()); } @@ -128,11 +128,10 @@ public class LocalFeedUpdater { feed.setDescription(context.getString(R.string.local_feed_description)); feed.setAuthor(context.getString(R.string.local_folder)); - // update items, delete items without existing file; - // only delete items if the folder contains at least one element to avoid accidentally - // deleting played state or position in case the folder is temporarily unavailable. - boolean removeUnlistedItems = (newItems.size() >= 1); - DBTasks.updateFeed(context, feed, removeUnlistedItems); + if (newItems.isEmpty()) { + throw new IOException("Empty folder. Make sure that the folder is accessible and contains media files."); + } + DBTasks.updateFeed(context, feed, true); } /** |