Skip to content

Commit 37df225

Browse files
committed
Remove length check from StringUtils.matchToClosingParenthesis
1 parent 852a65f commit 37df225

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/utils/StringUtils.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ private StringUtils() {
99
}
1010

1111
/**
12-
* @param string The string to search in
12+
* @param string The string to search in.
1313
* @param start A string from which to start searching.
14-
* @return A substring where each '{' matches a '}'
14+
* @return A substring where each '{' matches a '}'.
1515
* @throws IndexOutOfBoundsException If {@code string} does not contain {@code start}
16+
* or parenthesis could not be matched .
1617
*/
1718
@Nonnull
1819
public static String matchToClosingParenthesis(@Nonnull final String string, @Nonnull final String start) {
@@ -29,8 +30,7 @@ public static String matchToClosingParenthesis(@Nonnull final String string, @No
2930
++endIndex;
3031

3132
int openParenthesis = 1;
32-
int length = string.length();
33-
while (openParenthesis > 0 && endIndex < length) {
33+
while (openParenthesis > 0) {
3434
switch (string.charAt(endIndex)) {
3535
case '{':
3636
++openParenthesis;

0 commit comments

Comments
 (0)