Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ internal static bool IsTrue(IList objectArray)
// but since we don't want this to recurse indefinitely
// we explicitly check the case where it would recurse
// and deal with it.
IList firstElement = objectArray[0] as IList;
IList firstElement = PSObject.Base(objectArray[0]) as IList;

if (firstElement == null)
{
Expand Down
5 changes: 5 additions & 0 deletions test/powershell/engine/Api/LanguagePrimitive.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,9 @@
$ObjArray = [System.Management.Automation.LanguagePrimitives]::ConvertTo($col, [object[]])
$ObjArray.Length | Should Be $col.Count
}

It "Casting recursive array to bool should not cause crash" {
$a[0] = $a = [PSObject](,1)
[System.Management.Automation.LanguagePrimitives]::IsTrue($a) | Should Be $true
}
}