diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-03-15 18:42:53 +0000 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-03-15 18:42:53 +0000 |
commit | 4036fcc5c4dedb44a57fc7787fcefb3b89096504 (patch) | |
tree | 1fdaea2ab6c23559a7f7dbfb1913b8ce41d4187c | |
parent | d7f84f61a28ff308b0403ec9940dadc6e2894b41 (diff) | |
download | rails-4036fcc5c4dedb44a57fc7787fcefb3b89096504.tar.gz rails-4036fcc5c4dedb44a57fc7787fcefb3b89096504.tar.bz2 rails-4036fcc5c4dedb44a57fc7787fcefb3b89096504.zip |
Handle template error gracefully when line number cannot be derived. Closes #11327 [Nex3]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9027 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | actionpack/lib/action_view/template_error.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/template_error.rb b/actionpack/lib/action_view/template_error.rb index 33357d50cb..65d80362b5 100644 --- a/actionpack/lib/action_view/template_error.rb +++ b/actionpack/lib/action_view/template_error.rb @@ -41,8 +41,9 @@ module ActionView indent = ' ' * indentation line_counter = start_on_line - - source_code[start_on_line..end_on_line].sum do |line| + return unless source_code = source_code[start_on_line..end_on_line] + + source_code.sum do |line| line_counter += 1 "#{indent}#{line_counter}: #{line}" end |