From 7fcb3f579008565a80fc9542f13f96fee29e5d4f Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Sun, 23 Dec 2018 20:25:19 +0100 Subject: [PATCH] fix crash when return null as a related streams collector --- .../services/media_ccc/extractors/MediaCCCStreamExtractor.java | 2 +- .../org/schabi/newpipe/extractor/utils/ExtractorHelper.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCStreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCStreamExtractor.java index 6c0e0fad8..e95435851 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCStreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCStreamExtractor.java @@ -188,7 +188,7 @@ public class MediaCCCStreamExtractor extends StreamExtractor { @Override public StreamInfoItemsCollector getRelatedStreams() throws IOException, ExtractionException { - return null; + return new StreamInfoItemsCollector(getServiceId()); } @Override diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/utils/ExtractorHelper.java b/extractor/src/main/java/org/schabi/newpipe/extractor/utils/ExtractorHelper.java index 445c52c77..0fc6a3120 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/utils/ExtractorHelper.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/utils/ExtractorHelper.java @@ -30,6 +30,7 @@ public class ExtractorHelper { public static List getRelatedVideosOrLogError(StreamInfo info, StreamExtractor extractor) { try { InfoItemsCollector collector = extractor.getRelatedStreams(); + if(collector == null) return Collections.emptyList(); info.addAllErrors(collector.getErrors()); //noinspection unchecked