Skip to content

Commit

Permalink
Avoid panic when displaying unexpected token error
Browse files Browse the repository at this point in the history
Avoid entering unreachable!() when displaying an error message for an
invalid `<!` token. This fixes a panic when processing a malformed
XML which contains such token in an unexpected place, like the
following:

`<!DOCTYPEs/%<!A`
  • Loading branch information
00xc committed Jun 1, 2023
1 parent 563f975 commit c09549a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/reader/lexer.rs
Expand Up @@ -81,6 +81,7 @@ impl fmt::Display for Token {
Token::EqualsSign => "=",
Token::SingleQuote => "'",
Token::DoubleQuote => "\"",
Token::MarkupDeclarationStart => "<!",
_ => unreachable!()
}.fmt(f),
}
Expand Down

0 comments on commit c09549a

Please sign in to comment.