From 767db6ff268d29bf66ca4bc5a33340d69f32f8cc Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Wed, 23 Jul 2014 22:09:46 -0700 Subject: [PATCH] Frozen works strangely on nils --- middleman-core/lib/middleman-core/contracts.rb | 2 +- .../lib/middleman-core/util/hash_with_indifferent_access.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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