From e4671e399c13921428aabdec73c7f8a47be396d1 Mon Sep 17 00:00:00 2001 From: Graham Jenson Date: Sun, 10 Mar 2019 14:21:53 +0000 Subject: [PATCH] fix(parser): do not break if a non-intrinsic `Condition` statement is found in a YAML template (#169) --- intrinsics/intrinsics.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/intrinsics/intrinsics.go b/intrinsics/intrinsics.go index e77edff528..3630329d6a 100644 --- a/intrinsics/intrinsics.go +++ b/intrinsics/intrinsics.go @@ -219,8 +219,10 @@ func search(input interface{}, template interface{}, options *ProcessorOptions) if key == "Condition" { // This can lead to infinite recursion A -> B; B -> A; // pass state of the conditions that we're evaluating so we can detect cycles - // in case of cycle, return nil - return condition(key, search(val, template, options), template, options) + // in case of cycle or not found, do nothing + if con := condition(key, search(val, template, options), template, options); con != nil { + return con + } } // This is not an intrinsic function, recurse through it normally