aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/partial_mdx_jsx.rs
diff options
context:
space:
mode:
authorLibravatar Mick van Gelderen <mickvangelderen@gmail.com>2023-04-22 10:06:05 +0200
committerLibravatar GitHub <noreply@github.com>2023-04-22 10:06:05 +0200
commit66c6c21f7349ce6036673443afc2c1aa640682db (patch)
treee3556391fd0e0d092f3bb479a56711cd30116afd /src/construct/partial_mdx_jsx.rs
parentb3a921c761309ae00a51fe348d8a43adbc54b518 (diff)
downloadmarkdown-rs-66c6c21f7349ce6036673443afc2c1aa640682db.tar.gz
markdown-rs-66c6c21f7349ce6036673443afc2c1aa640682db.tar.bz2
markdown-rs-66c6c21f7349ce6036673443afc2c1aa640682db.zip
Fix crash in MDX whitespace
Related-to: GH-26. Closes GH-60.
Diffstat (limited to 'src/construct/partial_mdx_jsx.rs')
-rw-r--r--src/construct/partial_mdx_jsx.rs20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/construct/partial_mdx_jsx.rs b/src/construct/partial_mdx_jsx.rs
index fc03f82..2031a5a 100644
--- a/src/construct/partial_mdx_jsx.rs
+++ b/src/construct/partial_mdx_jsx.rs
@@ -1070,17 +1070,19 @@ pub fn es_whitespace_inside(tokenizer: &mut Tokenizer) -> State {
tokenizer.consume();
State::Next(StateName::MdxJsxEsWhitespaceInside)
}
- _ => {
+ Some(_)
if kind_after_index(tokenizer.parse_state.bytes, tokenizer.point.index)
- == CharacterKind::Whitespace
- {
- tokenizer.consume();
- State::Next(StateName::MdxJsxEsWhitespaceInside)
- } else {
- tokenizer.exit(Name::MdxJsxEsWhitespace);
- State::Ok
- }
+ == CharacterKind::Whitespace =>
+ {
+ tokenizer.consume();
+ State::Next(StateName::MdxJsxEsWhitespaceInside)
+ }
+ Some(_) => {
+ tokenizer.exit(Name::MdxJsxEsWhitespace);
+ State::Ok
}
+ // Handle EOF.
+ None => State::Nok,
}
}