diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-01-30 18:31:09 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-01-30 18:31:09 +0000 |
commit | de7703a988dab8f7445dac954ab652a296a3def3 (patch) | |
tree | a4c66128d6c954b607566e2f6172151648fc8ab1 /app | |
parent | 69a3af733e9fcd90d7007057ef79f85cdda13918 (diff) | |
parent | 382421a9bed1ef0fd1e97f6dcec8a104342ae1d8 (diff) | |
download | gitlab-ce-de7703a988dab8f7445dac954ab652a296a3def3.tar.gz |
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 |