Skip to content

Commit

Permalink
Guard against undefined module bodies in navbar/navtree.
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielRosenwasser authored Jan 12, 2022
1 parent f230a5a commit 3ba8469
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/services/navigationBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,10 @@ namespace ts.NavigationBar {
// We use 1 NavNode to represent 'A.B.C', but there are multiple source nodes.
// Only merge module nodes that have the same chain. Don't merge 'A.B.C' with 'A'!
function areSameModule(a: ModuleDeclaration, b: ModuleDeclaration): boolean {
return a.body!.kind === b.body!.kind && (a.body!.kind !== SyntaxKind.ModuleDeclaration || areSameModule(a.body as ModuleDeclaration, b.body as ModuleDeclaration));
if (!a.body || !b.body) {
return a.body === b.body;
}
return a.body.kind === b.body.kind && (a.body.kind !== SyntaxKind.ModuleDeclaration || areSameModule(a.body as ModuleDeclaration, b.body as ModuleDeclaration));
}

/** Merge source into target. Source should be thrown away after this is called. */
Expand Down

0 comments on commit 3ba8469

Please sign in to comment.