From 6f19e50a41a17dbf06e6281f005ade6a2f19dba4 Mon Sep 17 00:00:00 2001 From: Saravanan Balasubramanian <33908564+sarabala1979@users.noreply.github.com> Date: Mon, 22 Aug 2022 16:55:16 -0700 Subject: [PATCH] fix: Invalid memory address or nil pointer dereference (#9409) Signed-off-by: Saravanan Balasubramanian Signed-off-by: Saravanan Balasubramanian --- workflow/controller/operator.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/workflow/controller/operator.go b/workflow/controller/operator.go index a5c54cf8709b..92fa63d547c0 100644 --- a/workflow/controller/operator.go +++ b/workflow/controller/operator.go @@ -1944,13 +1944,14 @@ func (woc *wfOperationCtx) executeTemplate(ctx context.Context, nodeName string, } } - node = woc.wf.GetNodeByName(node.Name) - if node == nil { + retrieveNode := woc.wf.GetNodeByName(node.Name) + if retrieveNode == nil { err := fmt.Errorf("no Node found by the name of %s; wf.Status.Nodes=%+v", node.Name, woc.wf.Status.Nodes) woc.log.Error(err) woc.markWorkflowError(ctx, err) return node, err } + node = retrieveNode // Swap the node back to retry node if retryNodeName != "" {