diff --git a/src/util/Collection.js b/src/util/Collection.js index 3219fb8a63d8..259244f15e19 100644 --- a/src/util/Collection.js +++ b/src/util/Collection.js @@ -5,7 +5,7 @@ const Util = require('./Util'); class Collection extends BaseCollection { toJSON() { - return this.map(e => (typeof e.toJSON === 'function' ? e.toJSON() : Util.flatten(e))); + return this.map(e => (typeof e?.toJSON === 'function' ? e.toJSON() : Util.flatten(e))); } }