diff options
author | Stan Hu <stanhu@gmail.com> | 2015-09-18 22:02:01 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2015-09-18 22:02:01 +0300 |
commit | de8497ca56a20f8c9362fdb8a9a8629a551f0a4d (patch) | |
tree | 68a7e0a144f5145adc5b0a0fce292ae04b662b0e /app/controllers/projects/compare_controller.rb | |
parent | ac571623d88314c89773ecdb484fc1c4ea92de1a (diff) |
Fix Error 500 when comparing non-existing branches
Closes #2593
Diffstat (limited to 'app/controllers/projects/compare_controller.rb')
-rw-r--r-- | app/controllers/projects/compare_controller.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/app/controllers/projects/compare_controller.rb b/app/controllers/projects/compare_controller.rb index d9b3adae95b..d15004f93a6 100644 --- a/app/controllers/projects/compare_controller.rb +++ b/app/controllers/projects/compare_controller.rb @@ -16,10 +16,12 @@ class Projects::CompareController < Projects::ApplicationController compare_result = CompareService.new. execute(@project, head_ref, @project, base_ref) - @commits = compare_result.commits - @diffs = compare_result.diffs - @commit = @commits.last - @line_notes = [] + if compare_result + @commits = compare_result.commits + @diffs = compare_result.diffs + @commit = @commits.last + @line_notes = [] + end end def create |