Commit 51f48392abb225eaed58a6368382cdc28a961d3b
1 parent
d412abd1
Exists in
master
and in
4 other branches
Fix type error if there is a different location hash
Showing
1 changed file
with
4 additions
and
4 deletions
Show diff stats
app/assets/javascripts/tree.js.coffee
| ... | ... | @@ -40,12 +40,12 @@ $ -> |
| 40 | 40 | # "#L12" and "#L34-56" supported |
| 41 | 41 | highlightBlobLines = -> |
| 42 | 42 | if window.location.hash isnt "" |
| 43 | - matches = window.location.hash.match /\#L(\d+)(\-(\d+))?/ | |
| 44 | - first_line = parseInt matches[1] | |
| 45 | - last_line = parseInt matches[3] | |
| 43 | + matches = window.location.hash.match(/\#L(\d+)(\-(\d+))?/) | |
| 44 | + first_line = parseInt(matches?[1]) | |
| 45 | + last_line = parseInt(matches?[3]) | |
| 46 | 46 | |
| 47 | 47 | unless isNaN first_line |
| 48 | - last_line = first_line if isNaN last_line | |
| 48 | + last_line = first_line if isNaN(last_line) | |
| 49 | 49 | $("#tree-content-holder .highlight .line").removeClass("hll") |
| 50 | 50 | $("#LC#{line}").addClass("hll") for line in [first_line..last_line] |
| 51 | 51 | $("#L#{first_line}").ScrollTo() | ... | ... |