From fd4cce4ce1ee5164403f8b11f7affcb7de74aed4 Mon Sep 17 00:00:00 2001 From: George Fleming Date: Thu, 12 Nov 2015 13:20:25 -0800 Subject: [PATCH] Fix Exit-PSHostProcess cmdlet crash issue --- src/host/main.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/host/main.cs b/src/host/main.cs index 98f0477aef..3178749161 100644 --- a/src/host/main.cs +++ b/src/host/main.cs @@ -417,7 +417,7 @@ namespace Microsoft.Samples.PowerShell.Host // Read commands and run them until the ShouldExit flag is set by // the user calling "exit". - while (!this.ShouldExit) + while (!this.ShouldExit && this.myHost.Runspace != null) { string prompt = Prompt(this.myHost.Runspace);