Skip to content

Commit 3434f0a

Browse files
committed
Fix null error on missing "begin"
1 parent c5c64bf commit 3434f0a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/DiagnosticCollection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ function diagnosticsOnigurumaRegexErrors(diagnostics: vscode.Diagnostic[], trees
274274
* and replaces the backreferences directly
275275
*/
276276
if (/\\[1-9](\d{2})?(?!\d)/.test(regex)) {
277-
const beginNode = getLastNode(regexNode.parent.parent, 'begin').childForFieldName('regex');
277+
const beginNode = getLastNode(regexNode.parent.parent, 'begin')?.childForFieldName('regex');
278278
if (beginNode) {
279279
const beginRegex = trees.regexTrees.get(beginNode.id).rootNode;
280280
const captureGroupQuery = `;scm

0 commit comments

Comments
 (0)