diff options
author | Ben Pfaff <blp@nicira.com> | 2012-01-27 12:37:45 -0800 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2012-01-30 09:11:30 -0800 |
commit | 05e547e7ee479fa2c3ca5bc9d2eb57bc8a07bdb8 (patch) | |
tree | 51146977ebf0f88f6ed6c60f8088ac491cc0b6de /lib | |
parent | f85748f7f1228fc7dcf5a9280e01d4bd9f13df1e (diff) |
table: Avoid segmentation fault when printing an empty cell in JSON format.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/table.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/table.c b/lib/table.c index ff11e781..537fae97 100644 --- a/lib/table.c +++ b/lib/table.c @@ -480,8 +480,10 @@ table_print_json__(const struct table *table, const struct table_style *style) const struct cell *cell = table_cell__(table, y, x); if (cell->text) { json_array_add(row, json_string_create(cell->text)); - } else { + } else if (cell->json) { json_array_add(row, json_clone(cell->json)); + } else { + json_array_add(row, json_null_create()); } } json_array_add(data, row); |