From cc13a16e90c859ff1f96ca1fb7f1915b5b5065e4 Mon Sep 17 00:00:00 2001 From: hailaz <739476267@qq.com> Date: Thu, 15 Aug 2024 20:35:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=A0=91=E4=B8=BA=E7=A9=BA=E6=97=B6=EF=BC=8C=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/utility/tree/tree_list.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/utility/tree/tree_list.go b/server/utility/tree/tree_list.go index 3e71a9e..17c5ab2 100644 --- a/server/utility/tree/tree_list.go +++ b/server/utility/tree/tree_list.go @@ -13,6 +13,9 @@ type Node interface { // ListToTree 根据上下级关系将列表数据转为树状数据 func ListToTree(pid int64, nodes []Node) (list []Node, err error) { + if len(nodes) == 0 { + return nodes, nil + } for _, v := range nodes { if v.PID() == pid { item := v