Browse files

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
  • Loading branch information...
1 parent d7f84f6 commit 4036fcc5c4dedb44a57fc7787fcefb3b89096504 @lifo lifo committed Mar 15, 2008
Showing with 3 additions and 2 deletions.
  1. +3 −2 actionpack/lib/action_view/template_error.rb
View
5 actionpack/lib/action_view/template_error.rb
@@ -41,8 +41,9 @@ def source_extract(indentation = 0)
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

0 comments on commit 4036fcc

Please sign in to comment.