From f8ed1d7a81ecd8281e304c52cbceb2becd83839f Mon Sep 17 00:00:00 2001 From: Vinicius Stock Date: Tue, 15 Oct 2024 18:25:20 -0400 Subject: [PATCH] Prevent accessing rootUri if there's no git repository (#2727) --- vscode/src/workspace.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vscode/src/workspace.ts b/vscode/src/workspace.ts index cf85d6b3e..1adcc6db0 100644 --- a/vscode/src/workspace.ts +++ b/vscode/src/workspace.ts @@ -59,7 +59,10 @@ export class Workspace implements WorkspaceInterface { if (gitExtension) { const api = gitExtension.exports.getAPI(1); const repository = await api.openRepository(this.workspaceFolder.uri); - rootGitUri = repository.rootUri; + + if (repository) { + rootGitUri = repository.rootUri; + } } this.registerCreateDeleteWatcher(