Prevent failure with null in List toObject
This commit is contained in:
parent
a6fe10e527
commit
dad8266837
|
@ -75,7 +75,7 @@ List.prototype.push = function (obj) {
|
||||||
List.prototype.toObject = function (onlySchema, removeHidden) {
|
List.prototype.toObject = function (onlySchema, removeHidden) {
|
||||||
var items = [];
|
var items = [];
|
||||||
this.forEach(function (item) {
|
this.forEach(function (item) {
|
||||||
if (item.toObject) {
|
if (item && typeof item === 'object' && item.toObject) {
|
||||||
items.push(item.toObject(onlySchema, removeHidden));
|
items.push(item.toObject(onlySchema, removeHidden));
|
||||||
} else {
|
} else {
|
||||||
items.push(item);
|
items.push(item);
|
||||||
|
|
Loading…
Reference in New Issue