diff options
author | Eric Eastwood <contact@ericeastwood.com> | 2017-05-25 04:41:41 +0300 |
---|---|---|
committer | Eric Eastwood <contact@ericeastwood.com> | 2017-05-26 10:11:20 +0300 |
commit | 07a3a69ca89923aa040b87902fa13af4fe838f88 (patch) | |
tree | 708b6190370b4f91b97e1fd14eda0009eef6f49e /app/assets/javascripts/merge_request_tabs.js | |
parent | 34a6d80e1146b2e88a95f91c2bd84214f130d4c5 (diff) |
Fix error thrown with missing note fragment in DOM
Fix https://gitlab.com/gitlab-org/gitlab-ce/issues/32888
Reproduction:
1. Visit /namespace/project/merge_requests/x/diffs#note_1234
1. When `#note_1234` isn't in the diff, an error is thrown
Diffstat (limited to 'app/assets/javascripts/merge_request_tabs.js')
-rw-r--r-- | app/assets/javascripts/merge_request_tabs.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/assets/javascripts/merge_request_tabs.js b/app/assets/javascripts/merge_request_tabs.js index 22032d0f914..894ed81b044 100644 --- a/app/assets/javascripts/merge_request_tabs.js +++ b/app/assets/javascripts/merge_request_tabs.js @@ -285,7 +285,7 @@ import BlobForkSuggestion from './blob/blob_fork_suggestion'; // Similar to `toggler_behavior` in the discussion tab const hash = window.gl.utils.getLocationHash(); const anchor = hash && $container.find(`[id="${hash}"]`); - if (anchor) { + if (anchor && anchor.length > 0) { const notesContent = anchor.closest('.notes_content'); const lineType = notesContent.hasClass('new') ? 'new' : 'old'; notes.toggleDiffNote({ |