diff --git a/app/models/notification.rb b/app/models/notification.rb index 842d65726..e142f57b2 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -77,8 +77,12 @@ class Notification < ActiveRecord::Base # Be wary of calling this frequently. O(n) JSON parsing can suck. def data_hash @data_hash ||= begin + return nil if data.blank? - JSON.parse(data).with_indifferent_access + parsed = JSON.parse(data) + return nil if parsed.blank? + + parsed.with_indifferent_access end end