diff options
author | ByteHamster <info@bytehamster.com> | 2021-12-05 12:13:43 +0100 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2021-12-05 12:13:43 +0100 |
commit | 75a08335eb28eb1ffdcfde585b206a2051364313 (patch) | |
tree | a6ec61f7b9c886686bc355ae196f290ac3f05d45 | |
parent | 561141cfffaacc159660578a46cb393d7be5bc68 (diff) | |
download | AntennaPod-75a08335eb28eb1ffdcfde585b206a2051364313.zip |
Fix favorites export when item does not have website
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/export/favorites/FavoritesWriter.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/export/favorites/FavoritesWriter.java b/core/src/main/java/de/danoeh/antennapod/core/export/favorites/FavoritesWriter.java index 9bc273c9e..29de6ca80 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/export/favorites/FavoritesWriter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/export/favorites/FavoritesWriter.java @@ -117,10 +117,17 @@ public class FavoritesWriter implements ExportWriter { } private void writeFavoriteItem(Writer writer, FeedItem item, String favoriteTemplate) throws IOException { - String favItem = favoriteTemplate - .replace("{FAV_TITLE}", item.getTitle().trim()) - .replace("{FAV_WEBSITE}", item.getLink()) - .replace("{FAV_MEDIA}", item.getMedia().getDownload_url()); + String favItem = favoriteTemplate.replace("{FAV_TITLE}", item.getTitle().trim()); + if (item.getLink() != null) { + favItem = favItem.replace("{FAV_WEBSITE}", item.getLink()); + } else { + favItem = favItem.replace("{FAV_WEBSITE}", ""); + } + if (item.getMedia() != null && item.getMedia().getDownload_url() != null) { + favItem = favItem.replace("{FAV_MEDIA}", item.getMedia().getDownload_url()); + } else { + favItem = favItem.replace("{FAV_MEDIA}", ""); + } writer.append(favItem); } |