Skip to content

Commit 2d0658a

Browse files
committed
WIP: Fix null dereference and assumption
1 parent cf27369 commit 2d0658a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/PowerShellEditorServices/Services/PowerShell/Host/PsesInternalHost.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ private void PopPowerShell(RunspaceChangeAction runspaceChangeAction = RunspaceC
504504
{
505505
// If we're changing runspace, make sure we move the handlers over
506506
RunspaceFrame previousRunspaceFrame = _runspaceStack.Peek();
507-
if (previousRunspaceFrame.Runspace != CurrentPowerShell.Runspace)
507+
if (_psFrameStack.Count == 0 || previousRunspaceFrame.Runspace != CurrentPowerShell.Runspace)
508508
{
509509
_runspaceStack.Pop();
510510
RunspaceFrame currentRunspaceFrame = _runspaceStack.Peek();

0 commit comments

Comments
 (0)