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