diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-01-30 21:31:09 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2018-02-14 23:13:02 +0300 |
commit | 721a26d91a9064d76824141753e0050f25a7c508 (patch) | |
tree | 79e6659157334611c70c7e92851cbc169fef1876 /app | |
parent | 74b3192a295f907a03b5e8c70105c18d066f295b (diff) |
Merge branch '42160-error-500-loading-merge-request-undefined-method-index-for-nil-nilclass' into 'master'
Resolve "Error 500 loading merge request: undefined method `index' for nil:NilClass"
Closes #42160
See merge request gitlab-org/gitlab-ce!16795
Diffstat (limited to 'app')
-rw-r--r-- | app/models/concerns/discussion_on_diff.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/concerns/discussion_on_diff.rb b/app/models/concerns/discussion_on_diff.rb index db9770fabf4..8b3c55387b3 100644 --- a/app/models/concerns/discussion_on_diff.rb +++ b/app/models/concerns/discussion_on_diff.rb @@ -37,6 +37,8 @@ module DiscussionOnDiff # Returns an array of at most 16 highlighted lines above a diff note def truncated_diff_lines(highlight: true) + return [] if diff_line.nil? && first_note.is_a?(LegacyDiffNote) + lines = highlight ? highlighted_diff_lines : diff_lines initial_line_index = [diff_line.index - NUMBER_OF_TRUNCATED_DIFF_LINES + 1, 0].max |