File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
shell/AIShell.Integration Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -7,5 +7,10 @@ if ($null -eq $module -or $module.Version -lt [version]"2.4.2") {
77 throw " The PSReadLine v2.4.2-beta2 or higher is required for the AIShell module to work properly."
88}
99
10+ $runspace = $Host.Runspace
11+ if ($null -eq $runspace ) {
12+ throw " Failed to import the module because '`$ Host.Runspace' unexpectedly returns null.`n The host details:`n $ ( $Host | Out-String - Width 120 ) "
13+ }
14+
1015# # Create the channel singleton when loading the module.
11- $null = [AIShell.Integration.Channel ]::CreateSingleton($host .Runspace , [Microsoft.PowerShell.PSConsoleReadLine ])
16+ $null = [AIShell.Integration.Channel ]::CreateSingleton($runspace , [Microsoft.PowerShell.PSConsoleReadLine ])
Original file line number Diff line number Diff line change @@ -31,6 +31,9 @@ public class Channel : IDisposable
3131
3232 private Channel ( Runspace runspace , Type psConsoleReadLineType )
3333 {
34+ ArgumentNullException . ThrowIfNull ( runspace ) ;
35+ ArgumentNullException . ThrowIfNull ( psConsoleReadLineType ) ;
36+
3437 _runspace = runspace ;
3538 _psrlType = psConsoleReadLineType ;
3639 _connSetupWaitHandler = new ManualResetEvent ( false ) ;
You can’t perform that action at this time.
0 commit comments