diff options
author | Dario Lombardo <lomato@gmail.com> | 2018-12-08 23:54:57 +0100 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2018-12-09 17:48:34 +0000 |
commit | 9e4878a8f45bc9823625be3a72bb20cde9ddd287 (patch) | |
tree | 731ddf51ee3ef2fe18f9b653913d7ff9305d4c2d /wsutil | |
parent | 86bd96866279c94ef2a6102612703971774bdc03 (diff) |
json_dumper: support 'null' json object.
Allow the function json_puts_string() to be called with the NULL
argument that translates to 'null' json object.
Change-Id: I3d2aafad446962d3342ab30b9d509f054d393c64
Reviewed-on: https://code.wireshark.org/review/30978
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'wsutil')
-rw-r--r-- | wsutil/json_dumper.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/wsutil/json_dumper.c b/wsutil/json_dumper.c index ebac957617..7ae9a0674a 100644 --- a/wsutil/json_dumper.c +++ b/wsutil/json_dumper.c @@ -39,6 +39,11 @@ enum json_dumper_change { static void json_puts_string(FILE *fp, const char *str) { + if (!str) { + fputs("null", fp); + return; + } + static const char json_cntrl[0x20][6] = { "u0000", "u0001", "u0002", "u0003", "u0004", "u0005", "u0006", "u0007", "b", "t", "n", "u000b", "f", "r", "u000e", "u000f", "u0010", "u0011", "u0012", "u0013", "u0014", "u0015", "u0016", "u0017", "u0018", "u0019", "u001a", "u001b", "u001c", "u001d", "u001e", "u001f" |