From 0b0b4a882f878c8ae8326a7a5f93a1103c9808e0 Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Fri, 13 Sep 2024 11:06:03 -0700 Subject: [PATCH] handle broken bridges --- src/GitlabCli/Pipelines.psm1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/GitlabCli/Pipelines.psm1 b/src/GitlabCli/Pipelines.psm1 index 51a3f81..ec3cf14 100644 --- a/src/GitlabCli/Pipelines.psm1 +++ b/src/GitlabCli/Pipelines.psm1 @@ -161,7 +161,12 @@ function Get-GitlabPipeline { foreach ($Downstream in $DownstreamList) { $MatchingBridge = $Bridges | Where-Object { $_.DownstreamPipeline.id -eq $Downstream.Id } - $DownstreamMap[$MatchingBridge.Name] = $Downstream + if ($MatchingBridge) { + $DownstreamMap[$MatchingBridge.Name] = $Downstream + } + else { + Write-Debug -Message "No bridge found for $($Downstream.Id)" + } } $Pipeline | Add-Member -MemberType 'NoteProperty' -Name 'Downstream' -Value $DownstreamMap }