Skip to content

Commit

Permalink
Fixed infinite loop bug
Browse files Browse the repository at this point in the history
  • Loading branch information
nathansng committed Jan 28, 2022
1 parent 271c467 commit fe4a258
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions MarkdownParse.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ public static ArrayList<String> getLinks(String markdown) {
int nextCloseBracket = markdown.indexOf("]", nextOpenBracket);
int openParen = markdown.indexOf("(", nextCloseBracket);
int closeParen = markdown.indexOf(")", openParen);
// Check if no more possible links
if (nextOpenBracket < 0) {
break;
}
// Check to make sure it's not an image
if (nextOpenBracket > 0 && markdown.charAt(nextOpenBracket-1) == '!') {
currentIndex = closeParen + 1;
Expand Down

0 comments on commit fe4a258

Please sign in to comment.