mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-27 01:25:36 -05:00
Avoid null ref when workspace folder uri is undefined (#2179)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user