Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/PowerShellEditorServices/Session/PowerShellContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -845,8 +845,12 @@ await this.ExecuteCommand<object>(

if (typeof(TResult) != typeof(PSObject))
{
return
results
return (results.FirstOrDefault() == null)
// Evaluates to null but couldn't put just null (needs to be a TResult) and also couldn't cast null to TResult
? results
.OfType<TResult>()
.FirstOrDefault()
: results
.Select(pso => pso.BaseObject)
.OfType<TResult>()
.FirstOrDefault();
Expand Down