From 58b5bee598a30ca98c06d430281f81e499c9cf63 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Wed, 16 Oct 2024 16:22:59 -0700 Subject: [PATCH] don't rely on there ALWAYS being an artifact list to pull from. sometimes that is totally unspecified. (#8131) Co-authored-by: Scott Beddall --- eng/common/scripts/Package-Properties.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/eng/common/scripts/Package-Properties.ps1 b/eng/common/scripts/Package-Properties.ps1 index 72810397c94..62626f786f0 100644 --- a/eng/common/scripts/Package-Properties.ps1 +++ b/eng/common/scripts/Package-Properties.ps1 @@ -103,8 +103,11 @@ class PackageProps $content = Get-Content -Raw -Path $ymlPath | CompatibleConvertFrom-Yaml if ($content) { $artifacts = $this.GetValueSafely($content, @("extends", "parameters", "Artifacts")) + $artifactForCurrentPackage = $null - $artifactForCurrentPackage = $artifacts | Where-Object { $_["name"] -eq $this.ArtifactName -or $_["name"] -eq $this.Name } + if ($artifacts) { + $artifactForCurrentPackage = $artifacts | Where-Object { $_["name"] -eq $this.ArtifactName -or $_["name"] -eq $this.Name } + } if ($artifactForCurrentPackage) { return [HashTable]$artifactForCurrentPackage