From 487b240404c5fbb9982651ce0e4f9829042488a4 Mon Sep 17 00:00:00 2001 From: Jonathan Rudenberg Date: Fri, 14 Oct 2011 11:21:22 -0400 Subject: [PATCH] Fix another drop call regression --- lib/liquid/drop.rb | 2 +- test/lib/liquid/drop_test.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/liquid/drop.rb b/lib/liquid/drop.rb index ccb4d3c1..91b4c1a8 100644 --- a/lib/liquid/drop.rb +++ b/lib/liquid/drop.rb @@ -29,7 +29,7 @@ module Liquid # called by liquid to invoke a drop def invoke_drop(method_or_key) - if method_or_key != '' && self.class.public_method_defined?(method_or_key.to_s.to_sym) + if method_or_key && method_or_key != '' && self.class.public_method_defined?(method_or_key.to_s.to_sym) send(method_or_key.to_s.to_sym) else before_method(method_or_key) diff --git a/test/lib/liquid/drop_test.rb b/test/lib/liquid/drop_test.rb index e5b2d810..2bca2b3c 100644 --- a/test/lib/liquid/drop_test.rb +++ b/test/lib/liquid/drop_test.rb @@ -159,4 +159,8 @@ class DropsTest < Test::Unit::TestCase def test_empty_string_value_access assert_equal '', Liquid::Template.parse('{{ product[value] }}').render('product' => ProductDrop.new, 'value' => '') end + + def test_nil_value_access + assert_equal '', Liquid::Template.parse('{{ product[value] }}').render('product' => ProductDrop.new, 'value' => nil) + end end # DropsTest