Skip to content

Commit

Permalink
Fix crash on syntax error
Browse files Browse the repository at this point in the history
  • Loading branch information
duckdoom4 committed Jul 10, 2024
1 parent 2a0baeb commit 3e3b7b1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/tokenizer/tokenizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,10 @@ class DocumentTokenizer {
* @param caret The reader head position within the document
*/
private applyCaptures(captures: TokenPatternCapture, match: RegExpExecArray, source: string, parentNode: TreeNode) {
if (match.indices === undefined) {
return; // syntax error
}

let rootNode = parentNode;

if (captures[0] !== undefined) {
Expand Down

0 comments on commit 3e3b7b1

Please sign in to comment.