diff --git a/lib/list.js b/lib/list.js index 4c4158eb..27c2a534 100644 --- a/lib/list.js +++ b/lib/list.js @@ -75,7 +75,7 @@ List.prototype.push = function (obj) { List.prototype.toObject = function (onlySchema, removeHidden) { var items = []; this.forEach(function (item) { - if (item.toObject) { + if (item && typeof item === 'object' && item.toObject) { items.push(item.toObject(onlySchema, removeHidden)); } else { items.push(item);