aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/action_view/template_error.rb5
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