From a27a45fcfe2d639bdb06bdd0d83217c38e0d1eb0 Mon Sep 17 00:00:00 2001 From: chuxing <923622908@qq.com> Date: Fri, 17 Jun 2022 13:40:11 +0800 Subject: [PATCH] [fix][master]: fix condition npe (#10478) * [fix][master]: fix condition npe * [fix][master]: fix condition npe Co-authored-by: huaangcg (cherry picked from commit 0dd6f4008e146097026626c6e1dd47820cdec6bd) --- .../org/apache/dolphinscheduler/dao/utils/DagHelper.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/DagHelper.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/DagHelper.java index a3bd022192..9aa69c333f 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/DagHelper.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/DagHelper.java @@ -39,6 +39,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.Optional; import org.apache.dolphinscheduler.spi.utils.StringUtils; import org.slf4j.Logger; @@ -375,9 +376,13 @@ public class DagHelper { } else { conditionTaskList.add(nodeCode); } + // the skipNodeList maybe null if no next task + skipNodeList = Optional.ofNullable(skipNodeList).orElse(new ArrayList<>()); for (String failedNode : skipNodeList) { setTaskNodeSkip(failedNode, dag, completeTaskList, skipTaskNodeList); } + // the conditionTaskList maybe null if no next task + conditionTaskList = Optional.ofNullable(conditionTaskList).orElse(new ArrayList<>()); return conditionTaskList; }