Skip to content

Commit 5d43108

Browse files
committed
Added null check for profile when loaded from a Constrained Runspace
1 parent 798f429 commit 5d43108

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/PowerShellEditorServices.Hosting/Commands/StartEditorServicesCommand.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,14 +361,19 @@ private EditorServicesConfig CreateConfigObject()
361361
LanguageServiceTransport = GetLanguageServiceTransport(),
362362
DebugServiceTransport = GetDebugServiceTransport(),
363363
InitialSessionState = initialSessionState,
364-
ProfilePaths = new ProfilePathConfig
364+
365+
};
366+
367+
if(profile != null)
368+
{
369+
editorServicesConfig.ProfilePaths = new ProfilePathConfig
365370
{
366371
AllUsersAllHosts = GetProfilePathFromProfileObject(profile, ProfileUserKind.AllUsers, ProfileHostKind.AllHosts),
367372
AllUsersCurrentHost = GetProfilePathFromProfileObject(profile, ProfileUserKind.AllUsers, ProfileHostKind.CurrentHost),
368373
CurrentUserAllHosts = GetProfilePathFromProfileObject(profile, ProfileUserKind.CurrentUser, ProfileHostKind.AllHosts),
369374
CurrentUserCurrentHost = GetProfilePathFromProfileObject(profile, ProfileUserKind.CurrentUser, ProfileHostKind.CurrentHost),
370-
},
371-
};
375+
};
376+
}
372377

373378
if (StartupBanner != null)
374379
{

0 commit comments

Comments
 (0)