From cb0340d6e6c645ff1ffc9220eeb211ab84ada997 Mon Sep 17 00:00:00 2001 From: Karl Lehenbauer Date: Thu, 13 Feb 2014 19:10:19 +0000 Subject: [PATCH] Don't coredump if a bson object doesn't contain anything. BUGZID: --- generic/bson.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/generic/bson.c b/generic/bson.c index 2a1720f..9a7e74d 100644 --- a/generic/bson.c +++ b/generic/bson.c @@ -17,6 +17,11 @@ mongotcl_bsontolist_raw (Tcl_Interp *interp, Tcl_Obj *listObj, const char *data bson_timestamp_t ts; char oidhex[25]; bson scope; + + if (data == NULL) { + return listObj; + } + bson_iterator_from_buffer(&i, data); while (bson_iterator_next (&i)) {