Skip to content

Commit

Permalink
[mode/simple addon] Fix null dereference error on empty sub-matches
Browse files Browse the repository at this point in the history
Closes #6618
  • Loading branch information
marijnh committed Mar 9, 2021
1 parent ae2114a commit 769daa5
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions addon/mode/simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,9 @@
var token = rule.token
if (token && token.apply) token = token(matches)
if (matches.length > 2 && rule.token && typeof rule.token != "string") {
state.pending = [];
for (var j = 2; j < matches.length; j++)
if (matches[j])
state.pending.push({text: matches[j], token: rule.token[j - 1]});
(state.pending || (state.pending = [])).push({text: matches[j], token: rule.token[j - 1]});
stream.backUp(matches[0].length - (matches[1] ? matches[1].length : 0));
return token[0];
} else if (token && token.join) {
Expand Down

0 comments on commit 769daa5

Please sign in to comment.