Avoid possible NullPointerException in MediaCCCRecentKiosk.
This commit is contained in:
parent
a99af9bb6e
commit
0e31c86aee
|
@ -12,6 +12,7 @@ import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||||
import org.schabi.newpipe.extractor.kiosk.KioskExtractor;
|
import org.schabi.newpipe.extractor.kiosk.KioskExtractor;
|
||||||
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
|
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.StreamInfoItem;
|
||||||
import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector;
|
import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector;
|
||||||
|
|
||||||
|
@ -49,12 +50,12 @@ public class MediaCCCRecentKiosk extends KioskExtractor<StreamInfoItem> {
|
||||||
|
|
||||||
// Streams in the recent kiosk are not ordered by the release date.
|
// 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.
|
// Sort them to have the latest stream at the beginning of the list.
|
||||||
Comparator<StreamInfoItem> comparator = Comparator.comparing(
|
final Comparator<StreamInfoItem> comparator = Comparator
|
||||||
streamInfoItem -> streamInfoItem.getUploadDate().offsetDateTime());
|
.comparing(StreamInfoItem::getUploadDate, Comparator
|
||||||
comparator = comparator.reversed();
|
.nullsLast(Comparator.comparing(DateWrapper::offsetDateTime)))
|
||||||
|
.reversed();
|
||||||
final StreamInfoItemsCollector collector =
|
final StreamInfoItemsCollector collector = new StreamInfoItemsCollector(getServiceId(),
|
||||||
new StreamInfoItemsCollector(getServiceId(), comparator);
|
comparator);
|
||||||
|
|
||||||
events.stream()
|
events.stream()
|
||||||
.filter(JsonObject.class::isInstance)
|
.filter(JsonObject.class::isInstance)
|
||||||
|
|
Loading…
Reference in New Issue