Skip to content

Commit d1253d5

Browse files
author
zhengbli
committed
Added null checks
1 parent b16536b commit d1253d5

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

src/services/utilities.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -480,21 +480,21 @@ namespace ts {
480480
case SyntaxKind.LetKeyword:
481481
case SyntaxKind.ConstKeyword:
482482
// if the current token is var, let or const, skip the VariableDeclarationList
483-
node = node.parent.parent;
483+
node = node.parent === undefined ? undefined : node.parent.parent;
484484
break;
485485
default:
486486
node = node.parent;
487487
break;
488488
}
489-
if (!node.jsDocComment) {
490-
node = node.parent;
491-
}
492489
}
493-
let jsDocComment = node.jsDocComment;
494-
if (jsDocComment) {
495-
for (let tag of jsDocComment.tags) {
496-
if (tag.pos <= position && position <= tag.end) {
497-
return tag;
490+
491+
if (node) {
492+
let jsDocComment = node.jsDocComment;
493+
if (jsDocComment) {
494+
for (let tag of jsDocComment.tags) {
495+
if (tag.pos <= position && position <= tag.end) {
496+
return tag;
497+
}
498498
}
499499
}
500500
}

0 commit comments

Comments
 (0)