From 91452db76d3888c69941b24a8162baceee943cb4 Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Tue, 12 Apr 2022 10:42:30 +1000 Subject: [PATCH] chore: maybe fix a bug --- lib/pact_broker/pacts/eager_loaders.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/pact_broker/pacts/eager_loaders.rb b/lib/pact_broker/pacts/eager_loaders.rb index 312953c95..36de1bc8d 100644 --- a/lib/pact_broker/pacts/eager_loaders.rb +++ b/lib/pact_broker/pacts/eager_loaders.rb @@ -32,7 +32,10 @@ def self.populate_associations_for_consumer_and_provider(_key, pact_publications pact_publications.each do | pact_publication | pact_publication.consumer_version_tags.collect(&:name).sort.each do | tag_name | - pact_publication.associations[:head_pact_publications_for_tags] << head_pact_publications_by_tag[tag_name] + # Not sure how this can ever be nil, but a PF error suggests that it has happend. Maybe a timing issue? + if head_pact_publications_by_tag[tag_name] + pact_publication.associations[:head_pact_publications_for_tags] << head_pact_publications_by_tag[tag_name] + end end end end