Skip to content

Commit 45f6afb

Browse files
authored
TypeError: Cannot read properties of undefined (reading 'number') (#4894) (#4903)
1 parent 68cf7c5 commit 45f6afb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/github/githubRepository.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,9 @@ export class GitHubRepository implements vscode.Disposable {
468468

469469
if (data?.repository.pullRequests.nodes.length > 0) {
470470
const prs = data.repository.pullRequests.nodes.map(node => parseGraphQLPullRequest(node, this)).filter(pr => pr.head?.repo.owner === headOwner);
471+
if (prs.length === 0) {
472+
return undefined;
473+
}
471474
const mostRecentOrOpenPr = prs.find(pr => pr.state.toLowerCase() === 'open') ?? prs[0];
472475
return this.createOrUpdatePullRequestModel(mostRecentOrOpenPr);
473476
}

0 commit comments

Comments
 (0)