Skip to content
Browse files

Kept getting this in our errors, under Self.Errbit rather than for ou…

…r app:

NoMethodError: undefined method `[]' for nil:NilClass
tracing to [PROJECT_ROOT]/app/models/notice.rb:127 → block in sanitize
Looks like line can be nil, in which case line['blabla'] will make a SNAFU. A test for line not nil seemed the cheapest solution here.
  • Loading branch information...
1 parent 3bfad3d commit 3bcc3e314bfc3e5565c7372243a27484b3a905b3 @CristinaRO committed Apr 29, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 app/models/notice.rb
View
2 app/models/notice.rb
@@ -124,7 +124,7 @@ def sanitize
send("#{h}=",sanitize_hash(send(h)))
end
# Set unknown backtrace files
- backtrace.each{|line| line['file'] = "[unknown source]" if line['file'].blank? }
+ backtrace.each{|line| line['file'] = "[unknown source]" if line && line['file'].blank? }
end
def sanitize_hash(h)

0 comments on commit 3bcc3e3

Please sign in to comment.
Something went wrong with that request. Please try again.