From d690b8049309a7d1bb368d2c354665ef1505f5c9 Mon Sep 17 00:00:00 2001 From: Karl Burtram Date: Tue, 7 Aug 2018 19:48:26 -0400 Subject: [PATCH] Avoid null ref when workspace folder uri is undefined (#2179) --- src/sql/common/pathUtilities.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sql/common/pathUtilities.ts b/src/sql/common/pathUtilities.ts index 689b60b871..0cf4202960 100644 --- a/src/sql/common/pathUtilities.ts +++ b/src/sql/common/pathUtilities.ts @@ -42,7 +42,10 @@ export function resolveFilePath(uri: string, filePath: string, rootPath: string) export function getRootPath(contextService: IWorkspaceContextService): string { let isWorkspace = contextService.getWorkbenchState() === WorkbenchState.WORKSPACE; if (isWorkspace) { - return contextService.getWorkspace().folders[0].uri.fsPath; + let folder = contextService.getWorkspace().folders[0]; + if (folder && folder.uri) { + return folder.uri.fsPath; + } } return undefined;