From 4036fcc5c4dedb44a57fc7787fcefb3b89096504 Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Sat, 15 Mar 2008 18:42:53 +0000 Subject: 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 --- actionpack/lib/action_view/template_error.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'actionpack/lib') 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 -- cgit v1.2.3