workaround attempt to parse nil JSON string value

GSoC/Meterpreter_Web_Console
Matthew Kienow 2018-03-12 14:19:30 -04:00
parent 636284d530
commit fcd2bbd1de
No known key found for this signature in database
GPG Key ID: 40787F8B1EAC6E41
1 changed files with 1 additions and 0 deletions

View File

@ -84,6 +84,7 @@ module ResponseDataHelper
# @param [Class] base_class The base class to build back to. Used for recursion.
# @return [ActiveRecord::Base] A klass object, which inherits from ActiveRecord::Base.
def to_ar(klass, val, base_object = nil)
return nil unless val
data = val.class == Hash ? val.dup : JSON.parse(val)
obj = base_object || klass.new