diff options
author | Martin Fietz <Martin.Fietz@gmail.com> | 2015-10-04 10:28:32 +0200 |
---|---|---|
committer | Martin Fietz <Martin.Fietz@gmail.com> | 2015-10-04 10:28:32 +0200 |
commit | 91cc0b2527573bc653e8d15b6d4b8f16ae31937f (patch) | |
tree | d0f74a9851c3634e38cc5d3c5cb0ffb70ea69507 | |
parent | 844b54f26d6d9dbe33791957acc7f827a3644e4c (diff) | |
download | AntennaPod-91cc0b2527573bc653e8d15b6d4b8f16ae31937f.zip |
Take feeds with no items into account
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java index 061ce0634..7a8609b04 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java @@ -965,9 +965,15 @@ public final class DBReader { List<FeedItem> items = DBReader.getFeedItemList(rhs); rhs.setItems(items); } - Date d1 = lhs.getMostRecentItem().getPubDate(); - Date d2 = rhs.getMostRecentItem().getPubDate(); - return d2.compareTo(d1); + if(lhs.getMostRecentItem() == null) { + return 1; + } else if(rhs.getMostRecentItem() == null) { + return -1; + } else { + Date d1 = lhs.getMostRecentItem().getPubDate(); + Date d2 = rhs.getMostRecentItem().getPubDate(); + return d2.compareTo(d1); + } }; } |