Skip to content

Commit 450c5eb

Browse files
BloodHawkcodepunkt
authored andcommitted
Fix null pointer exception for postUpdateOne (#26)
1 parent 81d729c commit 450c5eb

File tree

4 files changed

+4054
-3479
lines changed

4 files changed

+4054
-3479
lines changed

lib/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ exports.default = function (schema, opts) {
188188
var conditions = Object.assign({}, this._conditions, this._update.$set || this._update);
189189

190190
this.model.findOne(conditions).then(function (doc) {
191+
if (!doc) return next();
191192
doc._original = _this3._original;
192193
return createPatch(doc, _this3.options);
193194
}).then(function () {

0 commit comments

Comments
 (0)