@@ -99,8 +99,12 @@ function GenerateMatrix(
99
99
[Array ]$nonSparseParameters = @ (),
100
100
[Switch ]$skipEnvironmentVariables
101
101
) {
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
+
104
108
if ($selectFromMatrixType -eq " sparse" ) {
105
109
$matrix = GenerateSparseMatrix $matrixParameters $config.displayNamesLookup $nonSparseParameters
106
110
}
@@ -144,6 +148,9 @@ function ProcessNonSparseParameters(
144
148
$nonSparse = [MatrixParameter []]@ ()
145
149
146
150
foreach ($param in $parameters ) {
151
+ if ($null -eq $param ){
152
+ continue
153
+ }
147
154
if ($param.Name -in $nonSparseParameters ) {
148
155
$nonSparse += $param
149
156
}
@@ -422,7 +429,11 @@ function ProcessImport([MatrixParameter[]]$matrix, [String]$selection, [Array]$n
422
429
}
423
430
}
424
431
if ((! $matrix -and ! $importPath ) -or ! $importPath ) {
425
- return $matrix , @ (), $displayNamesLookup
432
+ return [PSCustomObject ]@ {
433
+ Matrix = $matrix
434
+ ImportedMatrix = @ ()
435
+ DisplayNamesLookup = $displayNamesLookup
436
+ }
426
437
}
427
438
428
439
if (! (Test-Path $importPath )) {
@@ -444,7 +455,11 @@ function ProcessImport([MatrixParameter[]]$matrix, [String]$selection, [Array]$n
444
455
$combinedDisplayNameLookup [$lookup.Name ] = $lookup.Value
445
456
}
446
457
447
- return $matrix , $importedMatrix , $combinedDisplayNameLookup
458
+ return [PSCustomObject ]@ {
459
+ Matrix = $matrix ?? @ ()
460
+ ImportedMatrix = $importedMatrix
461
+ DisplayNamesLookup = $combinedDisplayNameLookup
462
+ }
448
463
}
449
464
450
465
function CombineMatrices ([Array ]$matrix1 , [Array ]$matrix2 , [Hashtable ]$displayNamesLookup = @ {}) {
@@ -628,6 +643,9 @@ function InitializeMatrix {
628
643
function GetMatrixDimensions ([MatrixParameter []]$parameters ) {
629
644
$dimensions = @ ()
630
645
foreach ($param in $parameters ) {
646
+ if ($null -eq $param ){
647
+ continue
648
+ }
631
649
$dimensions += $param.Length ()
632
650
}
633
651
0 commit comments