commit | 2e87477b7ad51c473919f3c991fe525f1ec70012 | [log] [tgz] |
---|---|---|
author | Radek Krejci <rkrejci@cesnet.cz> | Fri Aug 28 16:36:33 2020 +0200 |
committer | Radek Krejci <rkrejci@cesnet.cz> | Fri Aug 28 16:36:33 2020 +0200 |
tree | 6877856ce1b06c9e3a7481f27375c5cd7e1441bc | |
parent | 04d76c66a5157a61212351a9519e554e45e52b4a [diff] [blame] |
data printers BUGFIX handling print of no data (NULL tree)
diff --git a/src/printer_json.c b/src/printer_json.c index d002da1..0f77615 100644 --- a/src/printer_json.c +++ b/src/printer_json.c
@@ -858,6 +858,12 @@ struct jsonpr_ctx ctx = {0}; const char *delimiter = (options & LYD_PRINT_FORMAT) ? "\n" : ""; + if (!root) { + ly_print_(out, "{}%s", delimiter); + ly_print_flush(out); + return LY_SUCCESS; + } + ctx.out = out; ctx.level = 1; ctx.level_printed = 0;