From d9985c3d01a03d13dde1d58b90be1ef067364d2f Mon Sep 17 00:00:00 2001 From: Jan-Piet Mens Date: Wed, 2 Sep 2015 11:45:29 +0200 Subject: [PATCH] FIX: ocat: CSV output now correctly handles non-existent fields in output (e.g. pressure) --- ocat.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ocat.c b/ocat.c index 10ac33c..982668b 100644 --- a/ocat.c +++ b/ocat.c @@ -100,6 +100,9 @@ void csv_output(JsonNode *json, output_type otype, JsonNode *fields) if ((j = json_find_member(one, node->string_)) != NULL) { print_one(j, inttypes); printf("%c", node->next ? ',' : '\n'); + } else { + /* specified field not in JSON for this row */ + printf("%c", node->next ? ',' : '\n'); } } } else {