Commit 2add7932 authored by Vasilii Iakliushin's avatar Vasilii Iakliushin

Fix NoMethodError for UnfoldPresenter

Sentry error:
https://sentry.gitlab.net/gitlab/gitlabcom/issues/3168538

Add a fallback when array fetch returns `nil`

Changelog: fixed
parent 63a7d839
......@@ -108,7 +108,7 @@ module Blobs
def limit(lines)
return lines if full?
lines[since - 1..to - 1]
lines[since - 1..to - 1] || []
end
end
end
......@@ -206,6 +206,14 @@ RSpec.describe Blobs::UnfoldPresenter do
end
end
context 'when since exceeds number of lines' do
let(:params) { { since: 2 } }
it 'returns an empty list' do
expect(subject.lines.size).to eq(0)
end
end
context 'when full is true' do
let(:params) { { full: true } }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment