mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -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 {
|
export function getRootPath(contextService: IWorkspaceContextService): string {
|
||||||
let isWorkspace = contextService.getWorkbenchState() === WorkbenchState.WORKSPACE;
|
let isWorkspace = contextService.getWorkbenchState() === WorkbenchState.WORKSPACE;
|
||||||
if (isWorkspace) {
|
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;
|
return undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user