Skip to content

Commit

Permalink
Fix utf8.RuneError test
Browse files Browse the repository at this point in the history
arp242/uni@5f9eb0d

This is actually not really an issue here, because U+FFFD isn't valid in
TOML, but it doesn't hurt to properly check.
  • Loading branch information
arp242 committed Dec 3, 2023
1 parent 6fb5266 commit c320c2d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lex.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func (lx *lexer) next() (r rune) {
}

r, w := utf8.DecodeRuneInString(lx.input[lx.pos:])
if r == utf8.RuneError {
if r == utf8.RuneError && w == 1 {
lx.error(errLexUTF8{lx.input[lx.pos]})
return utf8.RuneError
}
Expand Down

0 comments on commit c320c2d

Please sign in to comment.