From 5b60ac942cdd942ff7db751a648781530bfd6d73 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Tue, 12 Jan 2021 14:58:30 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=A8=A1=E5=9D=97=E7=A7=BB=E5=8A=A8=E7=BC=BA?= =?UTF-8?q?=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/metersphere/service/NodeTreeService.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/io/metersphere/service/NodeTreeService.java b/backend/src/main/java/io/metersphere/service/NodeTreeService.java index fdac7d4c74..bca8f2bb11 100644 --- a/backend/src/main/java/io/metersphere/service/NodeTreeService.java +++ b/backend/src/main/java/io/metersphere/service/NodeTreeService.java @@ -2,6 +2,7 @@ package io.metersphere.service; import io.metersphere.commons.utils.BeanUtils; import io.metersphere.track.dto.TreeNodeDTO; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import java.util.*; @@ -123,7 +124,7 @@ public class NodeTreeService { * @param pathMap 记录节点路径对应的nodeId */ protected void createNodeByPathIterator(Iterator pathIterator, String path, T treeNode, - Map pathMap, String projectId, Integer level) { + Map pathMap, String projectId, Integer level) { List children = treeNode.getChildren(); @@ -161,8 +162,8 @@ public class NodeTreeService { * @param pNode 父节点 */ protected void createNodeByPath(Iterator pathIterator, String nodeName, - T pNode, String projectId, Integer level, - String rootPath, Map pathMap) { + T pNode, String projectId, Integer level, + String rootPath, Map pathMap) { StringBuilder path = new StringBuilder(rootPath); @@ -203,6 +204,8 @@ public class NodeTreeService { */ public void sort(List ids) { // 获取相邻节点 id + if (CollectionUtils.isEmpty(ids)) + return; String before = ids.get(0); String id = ids.get(1); String after = ids.get(2);