String comparing fix

This commit is contained in:
mrfry 2021-03-17 12:46:21 +01:00
parent 201119e05c
commit b5b0b8413a
2 changed files with 8 additions and 6 deletions

View file

@ -118,7 +118,7 @@ function compareString(
}
const currMatchIndex = s2a.indexOf(s1a[i])
if (lastMatchIndex < currMatchIndex) {
if (currMatchIndex !== -1 && lastMatchIndex < currMatchIndex) {
match++
lastMatchIndex = currMatchIndex
}