diff --git a/middleman-core/lib/middleman-core/contracts.rb b/middleman-core/lib/middleman-core/contracts.rb index 5fd05e11..a61952e5 100644 --- a/middleman-core/lib/middleman-core/contracts.rb +++ b/middleman-core/lib/middleman-core/contracts.rb @@ -23,7 +23,7 @@ if ENV['TEST'] || ENV['CONTRACTS'] == 'true' end def valid?(val) - val.frozen? && Contract.valid?(val, @contract) + (val.frozen? || val.nil?) && Contract.valid?(val, @contract) end end diff --git a/middleman-core/lib/middleman-core/util/hash_with_indifferent_access.rb b/middleman-core/lib/middleman-core/util/hash_with_indifferent_access.rb index 4f2254e9..d9bec962 100644 --- a/middleman-core/lib/middleman-core/util/hash_with_indifferent_access.rb +++ b/middleman-core/lib/middleman-core/util/hash_with_indifferent_access.rb @@ -92,7 +92,7 @@ module Middleman self.class.new(data) elsif data.is_a? Array data.map(&method(:recursively_enhance)).freeze - elsif data.frozen? + elsif data.frozen? || data.nil? data else data.dup.freeze