From e1dedd45ed99e2c52eb062d1fceb2d233bbeee89 Mon Sep 17 00:00:00 2001 From: FineFindus Date: Wed, 2 Apr 2025 22:14:01 +0200 Subject: [PATCH] [YouTube] Access first element if array size is one Fixes a regression, where if the challenge data array size was one, the second element would be accessed, leading to a crash. This was introduced when porting the challenge parsing from JS to Kotlin. Ref: https://github.com/TeamNewPipe/NewPipe/commit/53b599b042ff23cf2e74e3e8d90609b574a30fd1 --- .../main/java/org/schabi/newpipe/util/potoken/JavaScriptUtil.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/util/potoken/JavaScriptUtil.kt b/app/src/main/java/org/schabi/newpipe/util/potoken/JavaScriptUtil.kt index a9169e2c6..06740a00e 100644 --- a/app/src/main/java/org/schabi/newpipe/util/potoken/JavaScriptUtil.kt +++ b/app/src/main/java/org/schabi/newpipe/util/potoken/JavaScriptUtil.kt @@ -17,7 +17,7 @@ fun parseChallengeData(rawChallengeData: String): String { val descrambled = descramble(scrambled.getString(1)) JsonParser.array().from(descrambled) } else { - scrambled.getArray(1) + scrambled.getArray(0) } val messageId = challengeData.getString(0)