diff --git a/src/PowerShellEditorServices.Hosting/Commands/StartEditorServicesCommand.cs b/src/PowerShellEditorServices.Hosting/Commands/StartEditorServicesCommand.cs index 018a70224..0e698f812 100644 --- a/src/PowerShellEditorServices.Hosting/Commands/StartEditorServicesCommand.cs +++ b/src/PowerShellEditorServices.Hosting/Commands/StartEditorServicesCommand.cs @@ -378,7 +378,10 @@ private EditorServicesConfig CreateConfigObject() private string GetProfilePathFromProfileObject(PSObject profileObject, ProfileUserKind userKind, ProfileHostKind hostKind) { string profilePathName = $"{userKind}{hostKind}"; - + if (profileObject is null) + { + return null; + } string pwshProfilePath = (string)profileObject.Properties[profilePathName].Value; if (hostKind == ProfileHostKind.AllHosts) diff --git a/src/PowerShellEditorServices/Services/Workspace/Handlers/ConfigurationHandler.cs b/src/PowerShellEditorServices/Services/Workspace/Handlers/ConfigurationHandler.cs index b89c3d127..8cf04e5de 100644 --- a/src/PowerShellEditorServices/Services/Workspace/Handlers/ConfigurationHandler.cs +++ b/src/PowerShellEditorServices/Services/Workspace/Handlers/ConfigurationHandler.cs @@ -51,7 +51,7 @@ public override async Task Handle(DidChangeConfigurationParams request, Ca { LanguageServerSettingsWrapper incomingSettings = request.Settings.ToObject(); this._logger.LogTrace("Handling DidChangeConfiguration"); - if (incomingSettings == null) + if (incomingSettings is null || incomingSettings.Powershell is null) { this._logger.LogTrace("Incoming settings were null"); return await Unit.Task.ConfigureAwait(false);