🐛 handle repo undefined in vscode
This commit is contained in:
parent
0a3a403217
commit
8a0fb46e1f
1 changed files with 5 additions and 2 deletions
|
|
@ -31,8 +31,11 @@ class VsCodeIde implements IDE {
|
|||
async getRepoName(dir: string): Promise<string | undefined> {
|
||||
const repo = await this.getRepo(vscode.Uri.file(dir));
|
||||
const remote =
|
||||
repo.repository.remotes.find((r: any) => r.name === "origin") ??
|
||||
repo.repository.remotes[0];
|
||||
repo?.repository.remotes.find((r: any) => r.name === "origin") ??
|
||||
repo?.repository.remotes[0];
|
||||
if (!remote) {
|
||||
return undefined;
|
||||
}
|
||||
const ownerAndRepo = remote.fetchUrl
|
||||
.replace(".git", "")
|
||||
.split("/")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue