From 91d7d149c5f2742b3222db82b9aa75e8f62fcedb Mon Sep 17 00:00:00 2001 From: Robert Holt Date: Wed, 1 May 2019 09:50:57 +1000 Subject: [PATCH] Stop crash when workspace doesn't exist --- src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs b/src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs index 37d791198..c55727693 100644 --- a/src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs +++ b/src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs @@ -215,7 +215,8 @@ protected async Task HandleInitializeRequestAsync( editorSession.Workspace.WorkspacePath = initializeParams.RootPath; // Set the working directory of the PowerShell session to the workspace path - if (editorSession.Workspace.WorkspacePath != null) + if (editorSession.Workspace.WorkspacePath != null + && Directory.Exists(editorSession.Workspace.WorkspacePath)) { await editorSession.PowerShellContext.SetWorkingDirectoryAsync( editorSession.Workspace.WorkspacePath,