File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -38,13 +38,17 @@ void bson_free_deleter(std::uint8_t* ptr) {
3838
3939std::string to_json_helper (document::view view, decltype (bson_as_json) converter) {
4040 bson_t bson;
41- bson_init_static (&bson, view.data (), view.length ());
41+
42+ if (!bson_init_static (&bson, view.data (), view.length ())) {
43+ throw exception (error_code::k_failed_converting_bson_to_json);
44+ }
4245
4346 size_t size;
4447 auto result = converter (&bson, &size);
4548
46- if (!result)
49+ if (!result) {
4750 throw exception (error_code::k_failed_converting_bson_to_json);
51+ }
4852
4953 const auto deleter = [](char * result) { bson_free (result); };
5054 const std::unique_ptr<char [], decltype (deleter)> cleanup (result, deleter);
You can’t perform that action at this time.
0 commit comments