From 0c00bd05d3d2f0e1a6410ad91d7f94fb8640415b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=AD=A6=E5=B3=B0?= Date: Tue, 23 Aug 2022 10:40:22 +0800 Subject: [PATCH] fix: module tree for no data --- services/case_service.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/case_service.py b/services/case_service.py index ac535ef..401159b 100644 --- a/services/case_service.py +++ b/services/case_service.py @@ -256,6 +256,9 @@ async def get_follow_module_tree(node_id): if result['parent'] not in module_tree: module_tree[result['parent']] = list() module_tree[result['parent']].append(result) + if len(module_tree) == 0: + root['children'] = [] + return root, True __build_module_tree(module_tree[int(node_id)], module_tree) root['children'] = module_tree[int(node_id)] return root, True -- Gitee