summaryrefslogtreecommitdiff
path: root/app/models/merge_request.rb
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2019-01-09 14:18:46 +0900
committerShinya Maeda <shinya@gitlab.com>2019-01-10 14:02:43 +0900
commit1c248cd47ca1e02a32396c59f080c0170d81412a (patch)
treef6430b54634be2a47d747fbad206003e250a7ad2 /app/models/merge_request.rb
parentb2e807e62464a77dd9f4c50f4b339d4cd4f89718 (diff)
downloadgitlab-ce-1c248cd47ca1e02a32396c59f080c0170d81412a.tar.gz
Fix unexpected exception by failed to find an actual head pipeline
Add changelog
Diffstat (limited to 'app/models/merge_request.rb')
-rw-r--r--app/models/merge_request.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index 5310f2ee765..a9d1ece0d7e 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -1108,9 +1108,10 @@ class MergeRequest < ActiveRecord::Base
end
def update_head_pipeline
- self.head_pipeline = find_actual_head_pipeline
-
- update_column(:head_pipeline_id, head_pipeline.id) if head_pipeline_id_changed?
+ find_actual_head_pipeline.try do |pipeline|
+ self.head_pipeline = pipeline
+ update_column(:head_pipeline_id, head_pipeline.id) if head_pipeline_id_changed?
+ end
end
def merge_request_pipeline_exists?