From 03b242d4c328d0e557eadb1d44d214844bb814a2 Mon Sep 17 00:00:00 2001 From: Pete Davison Date: Sun, 30 Mar 2025 20:21:02 +0100 Subject: [PATCH] fix: bug where undefined/null variables resolve to "" instead of nil (#2144) --- compiler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler.go b/compiler.go index 753053ab..348a0728 100644 --- a/compiler.go +++ b/compiler.go @@ -75,7 +75,7 @@ func (c *Compiler) getVariables(t *ast.Task, call *Call, evaluateShVars bool) (* return err } // If the variable is already set, we can set it and return - if newVar.Value != nil { + if newVar.Value != nil || newVar.Sh == nil { result.Set(k, ast.Var{Value: newVar.Value}) return nil }