diff options
author | Lars Wirzenius <liw@liw.fi> | 2022-12-04 10:16:02 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2022-12-04 10:16:02 +0200 |
commit | f825c698e8ed2db636b6b859b1b2849889f1895f (patch) | |
tree | 422eb2cc560b0f3d1090d8214dbeb242adfbbf5d | |
parent | a2bb3de4db8b4cb7ab325511e9cbf0450f843295 (diff) | |
download | riki-f825c698e8ed2db636b6b859b1b2849889f1895f.tar.gz |
fix: avoid taking a too-long slice
Sponsored-by: author
-rw-r--r-- | src/parser.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/parser.rs b/src/parser.rs index 26a60ec..c81be74 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -198,7 +198,7 @@ impl WikitextParser { self.drain(6); break; } - _ => return Err(SiteError::wikitext_syntax(line, col, &self.tokens[..5])), + _ => return Err(SiteError::wikitext_syntax(line, col, &self.tokens[..std::cmp::min(5, self.tokens.len())])), } } if let Some(title) = title { |