@@ -99,8 +99,12 @@ function GenerateMatrix(
9999 [Array ]$nonSparseParameters = @ (),
100100 [Switch ]$skipEnvironmentVariables
101101) {
102- $matrixParameters , $importedMatrix , $combinedDisplayNameLookup = `
103- ProcessImport $config.matrixParameters $selectFromMatrixType $nonSparseParameters $config.displayNamesLookup
102+ $result = ProcessImport $config.matrixParameters $selectFromMatrixType $nonSparseParameters $config.displayNamesLookup
103+
104+ $matrixParameters = $result.Matrix
105+ $importedMatrix = $result.ImportedMatrix
106+ $combinedDisplayNameLookup = $result.DisplayNamesLookup
107+
104108 if ($selectFromMatrixType -eq " sparse" ) {
105109 $matrix = GenerateSparseMatrix $matrixParameters $config.displayNamesLookup $nonSparseParameters
106110 }
@@ -144,6 +148,9 @@ function ProcessNonSparseParameters(
144148 $nonSparse = [MatrixParameter []]@ ()
145149
146150 foreach ($param in $parameters ) {
151+ if ($null -eq $param ){
152+ continue
153+ }
147154 if ($param.Name -in $nonSparseParameters ) {
148155 $nonSparse += $param
149156 }
@@ -422,7 +429,11 @@ function ProcessImport([MatrixParameter[]]$matrix, [String]$selection, [Array]$n
422429 }
423430 }
424431 if ((! $matrix -and ! $importPath ) -or ! $importPath ) {
425- return $matrix , @ (), $displayNamesLookup
432+ return [PSCustomObject ]@ {
433+ Matrix = $matrix
434+ ImportedMatrix = @ ()
435+ DisplayNamesLookup = $displayNamesLookup
436+ }
426437 }
427438
428439 if (! (Test-Path $importPath )) {
@@ -444,7 +455,11 @@ function ProcessImport([MatrixParameter[]]$matrix, [String]$selection, [Array]$n
444455 $combinedDisplayNameLookup [$lookup.Name ] = $lookup.Value
445456 }
446457
447- return $matrix , $importedMatrix , $combinedDisplayNameLookup
458+ return [PSCustomObject ]@ {
459+ Matrix = $matrix ?? @ ()
460+ ImportedMatrix = $importedMatrix
461+ DisplayNamesLookup = $combinedDisplayNameLookup
462+ }
448463}
449464
450465function CombineMatrices ([Array ]$matrix1 , [Array ]$matrix2 , [Hashtable ]$displayNamesLookup = @ {}) {
@@ -628,6 +643,9 @@ function InitializeMatrix {
628643function GetMatrixDimensions ([MatrixParameter []]$parameters ) {
629644 $dimensions = @ ()
630645 foreach ($param in $parameters ) {
646+ if ($null -eq $param ){
647+ continue
648+ }
631649 $dimensions += $param.Length ()
632650 }
633651
0 commit comments