Skip to content

Commit

Permalink
Don't return number of occurrences < 0
Browse files Browse the repository at this point in the history
  • Loading branch information
gaebel committed Apr 22, 2021
1 parent 56e1ae2 commit 5621501
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,6 @@ open class MarkdownLink: MarkdownLinkElement {

fileprivate extension String {
func numberOfOccurrences(of string: String) -> Int {
return components(separatedBy: string).count - 1
return max(0, components(separatedBy: string).count - 1)
}
}

0 comments on commit 5621501

Please sign in to comment.