Skip to content

Commit 9a33d60

Browse files
authored
Stop crash when workspace doesn't exist (#949)
1 parent 161f471 commit 9a33d60

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ protected async Task HandleInitializeRequestAsync(
215215
editorSession.Workspace.WorkspacePath = initializeParams.RootPath;
216216

217217
// Set the working directory of the PowerShell session to the workspace path
218-
if (editorSession.Workspace.WorkspacePath != null)
218+
if (editorSession.Workspace.WorkspacePath != null
219+
&& Directory.Exists(editorSession.Workspace.WorkspacePath))
219220
{
220221
await editorSession.PowerShellContext.SetWorkingDirectoryAsync(
221222
editorSession.Workspace.WorkspacePath,

0 commit comments

Comments
 (0)