Merge pull request #905 from PowerShell/andschwa/fix-invalid-profile

Fix bug when loading bad profiles
This commit is contained in:
Andy Schwartzmeyer
2016-04-22 15:07:57 -07:00
@@ -354,8 +354,13 @@ OPTIONS
// accessed by the ctrl-C handler.
lock (this.instanceLock)
{
this.currentPowerShell.Dispose();
this.currentPowerShell = null;
// The PowerShell instance will be null if it failed to
// start due to, say, a parse exception in a profile.
if (this.currentPowerShell != null) {
this.currentPowerShell.Dispose();
this.currentPowerShell = null;
}
}
}
}
@@ -760,12 +765,12 @@ OPTIONS
// Stream output from command processing to console.
var output = new PSDataCollection<PSObject>();
output.DataAdded += (dSender, dArgs) =>
{
foreach (var item in output.ReadAll())
{
this.myHost.UI.WriteLine(item.ToString());
}
};
foreach (var item in output.ReadAll())
{
this.myHost.UI.WriteLine(item.ToString());
}
};
// Process command.
// The Debugger.ProcesCommand method will parse and handle debugger specific