From 72573932cfcf214e9cadd1fc762406747b615bc9 Mon Sep 17 00:00:00 2001 From: TobiGr Date: Tue, 24 Jan 2023 23:03:29 +0100 Subject: [PATCH] [YouTube] Fix NPE in search when getting channel items without subscriber count --- .../extractors/YoutubeChannelInfoItemExtractor.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelInfoItemExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelInfoItemExtractor.java index 8d1720f6..c683e3af 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelInfoItemExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelInfoItemExtractor.java @@ -96,8 +96,12 @@ public class YoutubeChannelInfoItemExtractor implements ChannelInfoItemExtractor } if (withHandle) { - return Utils.mixedNumberWordToLong(getTextFromObject( - channelInfoItem.getObject("videoCountText"))); + if (channelInfoItem.has("videoCountText")) { + return Utils.mixedNumberWordToLong(getTextFromObject( + channelInfoItem.getObject("videoCountText"))); + } else { + return -1; + } } return Utils.mixedNumberWordToLong(getTextFromObject(