Do not raise when variable is defined but nil when using strict_variables

This commit is contained in:
Pascal Betz
2017-08-18 12:09:57 -04:00
committed by Justin Li
parent 59162f7a0e
commit a979b3ec95
2 changed files with 12 additions and 1 deletions
+3 -1
View File
@@ -171,7 +171,9 @@ module Liquid
if scope.nil?
@environments.each do |e|
variable = lookup_and_evaluate(e, key, raise_on_not_found: raise_on_not_found)
unless variable.nil?
# When lookup returned a value OR there is no value but the lookup also did not raise
# then it is the value we are looking for.
if !variable.nil? || @strict_variables && raise_on_not_found
scope = e
break
end