Merge pull request #4684 from ByteHamster/fix-null-pubdate-crash
Fixed comparator method contract when date is null
This commit is contained in:
commit
97b557a3b6
|
@ -14,8 +14,12 @@ public class FeedItemPubdateComparator implements Comparator<FeedItem> {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int compare(FeedItem lhs, FeedItem rhs) {
|
public int compare(FeedItem lhs, FeedItem rhs) {
|
||||||
if (rhs.getPubDate() == null || lhs.getPubDate() == null) {
|
if (rhs.getPubDate() == null && lhs.getPubDate() == null) {
|
||||||
return 0;
|
return 0;
|
||||||
|
} else if (rhs.getPubDate() == null) {
|
||||||
|
return 1;
|
||||||
|
} else if (lhs.getPubDate() == null) {
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
return rhs.getPubDate().compareTo(lhs.getPubDate());
|
return rhs.getPubDate().compareTo(lhs.getPubDate());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue