File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
src/PowerShellEditorServices/Session Expand file tree Collapse file tree 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>>(
535535 if ( this . powerShell . HadErrors )
536536 {
537537 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 " ,
539539 GetStringForPSCommand ( psCommand ) ) ;
540540
541541 int i = 1 ;
@@ -838,15 +838,14 @@ await this.ExecuteCommand<object>(
838838
839839 Collection < PSObject > results = pipeline . Invoke ( ) ;
840840
841- if ( results . Count == 0 )
841+ if ( results . Count == 0 || results . FirstOrDefault ( ) == null )
842842 {
843843 return defaultValue ;
844844 }
845845
846846 if ( typeof ( TResult ) != typeof ( PSObject ) )
847847 {
848- return
849- results
848+ return results
850849 . Select ( pso => pso . BaseObject )
851850 . OfType < TResult > ( )
852851 . FirstOrDefault ( ) ;
You can’t perform that action at this time.
0 commit comments