From c3ccc0a53ba731c7995c3c8407665878f5a3cf34 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Mon, 5 Sep 2022 14:12:14 +0200 Subject: [PATCH] isisd: fix non present level display is show isis database detail json When a level is not present in show isis database detail json, {} is displayed. Display nothing for non present level. Fixes: a2cac12a63 ("isisd: Add json to show isis database command.") Signed-off-by: Louis Scalbert --- isisd/isisd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/isisd/isisd.c b/isisd/isisd.c index 2c4cee0607..982df0839b 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -2748,6 +2748,8 @@ static void show_isis_database_json(struct json_object *json, const char *sysid_ json_object_object_add(area_json,"area",tag_area_json); json_object_object_add(area_json,"levels",arr_json); for (level = 0; level < ISIS_LEVELS; level++) { + if (lspdb_count(&area->lspdb[level]) == 0) + continue; lsp_json = json_object_new_object(); show_isis_database_lspdb_json(lsp_json, area, level, &area->lspdb[level],