fix: handle when tthe default branch is not found

This commit is contained in:
tdurieux
2021-09-06 11:49:57 +02:00
parent fb1fa93869
commit 93258c8959

View File

@@ -100,7 +100,7 @@ export class GitHubRepository {
model.branches = this._data.branches;
const selected = model.branches.filter((f) => f.name == opt.branch)[0];
if (!selected?.readme || opt?.force === true) {
if (selected && (!selected.readme || opt?.force === true)) {
// get the list of repo from github
const octokit = new Octokit({ auth: opt.accessToken });
const ghRes = await octokit.repos.getReadme({