Skip to content

Commit

Permalink
Merge pull request #13839 from ZSabakh/patch-1
Browse files Browse the repository at this point in the history
Handle null objects in arrays during populate operations
  • Loading branch information
vkarpov15 authored Sep 8, 2023
2 parents 5eb374d + fbc01b8 commit 0c694ed
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/helpers/populate/markArraySubdocsPopulated.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ module.exports = function markArraySubdocsPopulated(doc, populated) {

if (utils.isMongooseDocumentArray(val)) {
for (let j = 0; j < val.length; ++j) {
val[j].populated(rest, item._docs[id] == null ? void 0 : item._docs[id][j], item);
if(val[j]){
val[j].populated(rest, item._docs[id] == null ? void 0 : item._docs[id][j], item);
}
}
break;
}
Expand Down

0 comments on commit 0c694ed

Please sign in to comment.