diff options
author | Shinya Maeda <shinya@gitlab.com> | 2019-01-09 14:18:46 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2019-01-10 14:02:43 +0900 |
commit | 1c248cd47ca1e02a32396c59f080c0170d81412a (patch) | |
tree | f6430b54634be2a47d747fbad206003e250a7ad2 /app/models/merge_request.rb | |
parent | b2e807e62464a77dd9f4c50f4b339d4cd4f89718 (diff) | |
download | gitlab-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.rb | 7 |
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? |