Skip to content

Commit 58011a5

Browse files
committed
PHPC-1442: Throw exception if no document from bulk write was received.
1 parent 707da29 commit 58011a5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/MongoDB/BulkWrite.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,13 @@ static PHP_METHOD(BulkWrite, insert)
371371

372372
intern->num_ops++;
373373

374-
if (bson_out) {
375-
php_phongo_bulkwrite_extract_id(bson_out, &return_value);
374+
if (!bson_out) {
375+
phongo_throw_exception(PHONGO_ERROR_LOGIC, "Did not receive result from bulk write. Please file a bug report.");
376+
goto cleanup;
376377
}
377378

379+
php_phongo_bulkwrite_extract_id(bson_out, &return_value);
380+
378381
cleanup:
379382
bson_destroy(&bdocument);
380383
bson_destroy(&boptions);

0 commit comments

Comments
 (0)