Skip to content

Commit

Permalink
Merge pull request #5129 from monkbroc/patch-1
Browse files Browse the repository at this point in the history
Avoid exception on constructor check
  • Loading branch information
vkarpov15 committed Mar 31, 2017
2 parents fe20693 + 6967687 commit 79fdf6a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/types/documentarray.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ MongooseDocumentArray.mixin = {
var Constructor = this._schema.casterConstructor;
if (value instanceof Constructor ||
// Hack re: #5001, see #5005
(value && value.constructor.baseCasterConstructor === Constructor)) {
(value && value.constructor && value.constructor.baseCasterConstructor === Constructor)) {
if (!(value.__parent && value.__parentArray)) {
// value may have been created using array.create()
value.__parent = this._parent;
Expand Down

0 comments on commit 79fdf6a

Please sign in to comment.