Skip to content

Commit

Permalink
Merge pull request #930 from Isira-Seneviratne/Avoid_Comparator_NPE
Browse files Browse the repository at this point in the history
Avoid possible NullPointerException in MediaCCCRecentKiosk.
  • Loading branch information
TobiGr authored Oct 10, 2022
2 parents d7c23ef + 0e31c86 commit 54092fc
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.kiosk.KioskExtractor;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
import org.schabi.newpipe.extractor.localization.DateWrapper;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector;

Expand Down Expand Up @@ -49,12 +50,12 @@ public InfoItemsPage<StreamInfoItem> getInitialPage() throws IOException, Extrac

// Streams in the recent kiosk are not ordered by the release date.
// Sort them to have the latest stream at the beginning of the list.
Comparator<StreamInfoItem> comparator = Comparator.comparing(
streamInfoItem -> streamInfoItem.getUploadDate().offsetDateTime());
comparator = comparator.reversed();

final StreamInfoItemsCollector collector =
new StreamInfoItemsCollector(getServiceId(), comparator);
final Comparator<StreamInfoItem> comparator = Comparator
.comparing(StreamInfoItem::getUploadDate, Comparator
.nullsLast(Comparator.comparing(DateWrapper::offsetDateTime)))
.reversed();
final StreamInfoItemsCollector collector = new StreamInfoItemsCollector(getServiceId(),
comparator);

events.stream()
.filter(JsonObject.class::isInstance)
Expand Down

0 comments on commit 54092fc

Please sign in to comment.