From 37df22555638c457aaac855e8a5ef087ee3fd044 Mon Sep 17 00:00:00 2001 From: XiangRongLin <41164160+XiangRongLin@users.noreply.github.com> Date: Sat, 31 Jul 2021 16:05:24 +0200 Subject: [PATCH] Remove length check from StringUtils.matchToClosingParenthesis --- .../org/schabi/newpipe/extractor/utils/StringUtils.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/utils/StringUtils.java b/extractor/src/main/java/org/schabi/newpipe/extractor/utils/StringUtils.java index 66f79360..a0429156 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/utils/StringUtils.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/utils/StringUtils.java @@ -9,10 +9,11 @@ public class StringUtils { } /** - * @param string The string to search in + * @param string The string to search in. * @param start A string from which to start searching. - * @return A substring where each '{' matches a '}' + * @return A substring where each '{' matches a '}'. * @throws IndexOutOfBoundsException If {@code string} does not contain {@code start} + * or parenthesis could not be matched . */ @Nonnull public static String matchToClosingParenthesis(@Nonnull final String string, @Nonnull final String start) { @@ -29,8 +30,7 @@ public class StringUtils { ++endIndex; int openParenthesis = 1; - int length = string.length(); - while (openParenthesis > 0 && endIndex < length) { + while (openParenthesis > 0) { switch (string.charAt(endIndex)) { case '{': ++openParenthesis;