Null pointer fix

This commit is contained in:
Mel O'Hagan 2022-05-13 15:07:26 +01:00 committed by mike12345567
parent 035a7ee625
commit c2fc1598fa
1 changed files with 3 additions and 1 deletions

View File

@ -91,7 +91,9 @@ module MongoDBModule {
json[field] = self.createObjectIds(json[field])
}
if (field === "_id") {
const id = json["_id"].match(/(?<=objectid\(['"]).*(?=['"]\))/gi)[0]
const id = json["_id"].match(
/(?<=objectid\(['"]).*(?=['"]\))/gi
)?.[0]
if (id) {
json["_id"] = new ObjectID.createFromHexString(id)
}