summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2012-09-03 17:52:45 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2012-09-24 14:57:54 +0200
commite273e0ef19f374baf35111584b65e619e3dbcaf8 (patch)
treea8844003bfd2f1561c35d8d975052b2aa154afbc /plugins
parent63f41c3efe5d77afbb28d17e00eeae77061b15a5 (diff)
downloadrsyslog-e273e0ef19f374baf35111584b65e619e3dbcaf8.tar.gz
rsyslog-e273e0ef19f374baf35111584b65e619e3dbcaf8.tar.xz
rsyslog-e273e0ef19f374baf35111584b65e619e3dbcaf8.zip
Handle JSON value "null" instead of crashing
Future json-c versions will handle this transparently, for now we have to do it manually. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ommongodb/ommongodb.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/plugins/ommongodb/ommongodb.c b/plugins/ommongodb/ommongodb.c
index c1648c50..2c65f275 100644
--- a/plugins/ommongodb/ommongodb.c
+++ b/plugins/ommongodb/ommongodb.c
@@ -296,7 +296,9 @@ static bson *BSONFromJSONObject(struct json_object *json);
static gboolean
BSONAppendJSONObject(bson *doc, const gchar *name, struct json_object *json)
{
- switch(json_object_get_type(json)) {
+ switch(json != NULL ? json_object_get_type(json) : json_type_null) {
+ case json_type_null:
+ return bson_append_null(doc, name);
case json_type_boolean:
return bson_append_boolean(doc, name,
json_object_get_boolean(json));