diff options
Diffstat (limited to 'src/utils/libsmartcols/src/print-api.c')
-rw-r--r-- | src/utils/libsmartcols/src/print-api.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/utils/libsmartcols/src/print-api.c b/src/utils/libsmartcols/src/print-api.c index 89dd3bf..237d9ae 100644 --- a/src/utils/libsmartcols/src/print-api.c +++ b/src/utils/libsmartcols/src/print-api.c @@ -119,8 +119,8 @@ static int do_print_table(struct libscols_table *tb, int *is_empty) if (scols_table_is_json(tb)) { ul_jsonwrt_init(&tb->json, tb->out, 0); ul_jsonwrt_root_open(&tb->json); - ul_jsonwrt_array_open(&tb->json, tb->name); - ul_jsonwrt_array_close(&tb->json, 1); + ul_jsonwrt_array_open(&tb->json, tb->name ? tb->name : ""); + ul_jsonwrt_array_close(&tb->json); ul_jsonwrt_root_close(&tb->json); } else if (is_empty) *is_empty = 1; @@ -134,7 +134,7 @@ static int do_print_table(struct libscols_table *tb, int *is_empty) if (scols_table_is_json(tb)) { ul_jsonwrt_root_open(&tb->json); - ul_jsonwrt_array_open(&tb->json, tb->name); + ul_jsonwrt_array_open(&tb->json, tb->name ? tb->name : ""); } if (tb->format == SCOLS_FMT_HUMAN) @@ -150,7 +150,7 @@ static int do_print_table(struct libscols_table *tb, int *is_empty) rc = __scols_print_table(tb, buf); if (scols_table_is_json(tb)) { - ul_jsonwrt_array_close(&tb->json, 1); + ul_jsonwrt_array_close(&tb->json); ul_jsonwrt_root_close(&tb->json); } done: |