dont crash on empty metadata during finalize

This commit is contained in:
Dominik Richter 2016-02-26 10:26:57 +01:00 committed by Christoph Hartmann
parent 0fb1b7d70d
commit 7cdb710e5e

View file

@ -140,6 +140,7 @@ module Inspec
end end
def self.finalize(metadata, profile_id) def self.finalize(metadata, profile_id)
return nil if metadata.nil?
param = metadata.params || {} param = metadata.params || {}
param['name'] = profile_id.to_s unless profile_id.to_s.empty? param['name'] = profile_id.to_s unless profile_id.to_s.empty?
param['version'] = param['version'].to_s unless param['version'].nil? param['version'] = param['version'].to_s unless param['version'].nil?