From e4358ff2fbf99194547a74df0288b5457eb5c288 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Thu, 14 Feb 2019 11:54:19 -0800 Subject: [PATCH] Strict null workspaceEditingService --- .../workspace/node/workspaceEditingService.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/vs/workbench/services/workspace/node/workspaceEditingService.ts b/src/vs/workbench/services/workspace/node/workspaceEditingService.ts index 28dafe22501..0f8bbc918b9 100644 --- a/src/vs/workbench/services/workspace/node/workspaceEditingService.ts +++ b/src/vs/workbench/services/workspace/node/workspaceEditingService.ts @@ -62,7 +62,7 @@ export class WorkspaceEditingService implements IWorkspaceEditingService { } // Add Folders - if (wantsToAdd && !wantsToDelete) { + if (wantsToAdd && !wantsToDelete && Array.isArray(foldersToAdd)) { return this.doAddFolders(foldersToAdd, index, donotNotifyError); } @@ -78,16 +78,16 @@ export class WorkspaceEditingService implements IWorkspaceEditingService { // other folders, we handle this specially and just enter workspace // mode with the folders that are being added. if (this.includesSingleFolderWorkspace(foldersToDelete)) { - return this.createAndEnterWorkspace(foldersToAdd); + return this.createAndEnterWorkspace(foldersToAdd!); } // if we are not in workspace-state, we just add the folders if (this.contextService.getWorkbenchState() !== WorkbenchState.WORKSPACE) { - return this.doAddFolders(foldersToAdd, index, donotNotifyError); + return this.doAddFolders(foldersToAdd!, index, donotNotifyError); } // finally, update folders within the workspace - return this.doUpdateFolders(foldersToAdd, foldersToDelete, index, donotNotifyError); + return this.doUpdateFolders(foldersToAdd!, foldersToDelete, index, donotNotifyError); } } @@ -176,7 +176,7 @@ export class WorkspaceEditingService implements IWorkspaceEditingService { const windows = await this.windowsService.getWindows(); // Prevent overwriting a workspace that is currently opened in another window - if (windows.some(window => window.workspace && isEqual(window.workspace.configPath, path))) { + if (windows.some(window => !!window.workspace && isEqual(window.workspace.configPath, path))) { const options: MessageBoxOptions = { type: 'info', buttons: [nls.localize('ok', "OK")], @@ -256,7 +256,7 @@ export class WorkspaceEditingService implements IWorkspaceEditingService { // Reinitialize backup service if (this.backupFileService instanceof BackupFileService) { - this.backupFileService.initialize(result.backupPath); + this.backupFileService.initialize(result.backupPath!); } // Reinitialize configuration service -- GitLab