Prevent failure with null in List toObject

This commit is contained in:
Fabien Franzen 2014-08-18 07:28:33 +02:00
parent a6fe10e527
commit dad8266837
1 changed files with 1 additions and 1 deletions

View File

@ -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);