Skip to content

Commit

Permalink
Merge pull request #12224 from hasezoey/tryFixUndefinedPropertyAcess
Browse files Browse the repository at this point in the history
fix(ChangeStream): try to fix "cannot read property fullDocument of undefined"
  • Loading branch information
vkarpov15 authored Aug 8, 2022
2 parents 2b94697 + 1a20c33 commit 265c658
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/cursor/ChangeStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class ChangeStream extends EventEmitter {

['close', 'change', 'end', 'error'].forEach(ev => {
this.driverChangeStream.on(ev, data => {
if (data.fullDocument != null && this.options && this.options.hydrate) {
if (data != null && data.fullDocument != null && this.options && this.options.hydrate) {
data.fullDocument = this.options.model.hydrate(data.fullDocument);
}
this.emit(ev, data);
Expand Down

0 comments on commit 265c658

Please sign in to comment.