From d98f81b296bce9532d080571aca07e5f33ea2c56 Mon Sep 17 00:00:00 2001 From: TobiGr Date: Sun, 26 Apr 2020 22:58:45 +0200 Subject: [PATCH] Fix detection of invalid textObject in getTextFromObject() a --- .../services/youtube/linkHandler/YoutubeParsingHelper.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/linkHandler/YoutubeParsingHelper.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/linkHandler/YoutubeParsingHelper.java index 6ebb2497fd..1615ee0ecd 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/linkHandler/YoutubeParsingHelper.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/linkHandler/YoutubeParsingHelper.java @@ -391,6 +391,10 @@ public static String getUrlFromNavigationEndpoint(JsonObject navigationEndpoint) * @return text in the JSON object or an empty string */ public static String getTextFromObject(JsonObject textObject, boolean html) throws ParsingException { + if (textObject == null || textObject.isEmpty()) { + return null; + } + if (textObject.has("simpleText")) return textObject.getString("simpleText"); StringBuilder textBuilder = new StringBuilder();