Skip to content

Commit

Permalink
Fix getReflectionsFromSymbolId to filter undefined reflections.
Browse files Browse the repository at this point in the history
getReflectionsFromSymbolId can return [undefined] in certain situations, causing downstream null pointer exceptions.

```
TypeError: Cannot read properties of undefined (reading 'kindOf')
    at ./node_modules/typedoc/dist/lib/models/types.js:688:25
    at Array.find (<anonymous>)
    at get reflection [as reflection] 
```
  • Loading branch information
nbilyk committed Feb 29, 2024
1 parent 9999d54 commit 8245b19
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "typedoc",
"description": "Create api documentation for TypeScript projects.",
"version": "0.25.9",
"version": "0.25.10",
"homepage": "https://typedoc.org",
"exports": {
".": "./dist/index.js",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/models/reflections/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@ export class ProjectReflection extends ContainerReflection {
if (typeof id === "number") {
return [this.getReflectionById(id)!];
} else if (typeof id === "object") {
return id.map((id) => this.getReflectionById(id)!);
return id.map((id) => this.getReflectionById(id))
.filter(reflection => reflection !== undefined);
}

return [];
Expand Down

0 comments on commit 8245b19

Please sign in to comment.