File tree 1 file changed +3
-4
lines changed
src/PowerShellEditorServices/Session
1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -535,7 +535,7 @@ await Task.Factory.StartNew<IEnumerable<TResult>>(
535
535
if ( this . powerShell . HadErrors )
536
536
{
537
537
var strBld = new StringBuilder ( 1024 ) ;
538
- strBld . AppendFormat ( "Execution of the following command(s) completed with errors:\r \n \r \n {0}\r \n " ,
538
+ strBld . AppendFormat ( "Execution of the following command(s) completed with errors:\r \n \r \n {0}\r \n " ,
539
539
GetStringForPSCommand ( psCommand ) ) ;
540
540
541
541
int i = 1 ;
@@ -838,15 +838,14 @@ await this.ExecuteCommand<object>(
838
838
839
839
Collection < PSObject > results = pipeline . Invoke ( ) ;
840
840
841
- if ( results . Count == 0 )
841
+ if ( results . Count == 0 || results . FirstOrDefault ( ) == null )
842
842
{
843
843
return defaultValue ;
844
844
}
845
845
846
846
if ( typeof ( TResult ) != typeof ( PSObject ) )
847
847
{
848
- return
849
- results
848
+ return results
850
849
. Select ( pso => pso . BaseObject )
851
850
. OfType < TResult > ( )
852
851
. FirstOrDefault ( ) ;
You can’t perform that action at this time.
0 commit comments