diff options
author | Sean McGivern <sean@gitlab.com> | 2018-01-03 14:18:13 +0000 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2018-01-04 14:33:12 +0000 |
commit | 528b5eeb761f627bb1972fa8a25a09dc1cea4556 (patch) | |
tree | 4b32a5e10e331b252599fdad40e44996ab5e5421 /lib/gitlab/metrics/transaction.rb | |
parent | e5a9b9a14d32d890dea20403c977dfd569eb3e17 (diff) | |
download | gitlab-ce-41468-error-500-trying-to-view-a-merge-request-json-undefined-method-binary-for-nil-nilclass.tar.gz |
Fix error when viewing diffs without blobs41468-error-500-trying-to-view-a-merge-request-json-undefined-method-binary-for-nil-nilclass
Old merge requests can have diffs without corresponding blobs. (This also may be
possible for commit diffs in corrupt repositories.)
We can't use the `&.` operator on the blobs, because the blob objects are never
nil, but `BatchLoader` instances that delegate to `Blob`. We can't use
`Object#try`, because `Blob` doesn't inherit from `Object`.
`BatchLoader` provides a `__sync` method that returns the delegated object, but
using `itself` also works because it's forwarded, and will work for
non-`BatchLoader` instances too. So the simplest solution is to just use that
with the `&.` operator.
Diffstat (limited to 'lib/gitlab/metrics/transaction.rb')
0 files changed, 0 insertions, 0 deletions