From 5065d468170f57e7527672be1d0b5235bddab819 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:06 -0700 Subject: [PATCH] Handle missing artifacts without exception (#2941) 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 72810397c..62626f786 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