mirror of
https://github.com/strapi/strapi.git
synced 2025-12-28 07:33:17 +00:00
Fix mongo toObject on null objectes
This commit is contained in:
parent
09761294e9
commit
515d756626
@ -400,7 +400,7 @@ module.exports = {
|
||||
transacting,
|
||||
});
|
||||
|
||||
return result.toJSON ? result.toJSON() : result;
|
||||
return result && result.toJSON ? result.toJSON() : result;
|
||||
},
|
||||
|
||||
async addRelationMorph(params, { transacting } = {}) {
|
||||
|
||||
@ -307,7 +307,9 @@ module.exports = {
|
||||
[this.primaryKey]: primaryKeyValue,
|
||||
}).populate(populate);
|
||||
|
||||
return updatedEntity.toObject ? updatedEntity.toObject() : updatedEntity;
|
||||
return updatedEntity && updatedEntity.toObject
|
||||
? updatedEntity.toObject()
|
||||
: updatedEntity;
|
||||
},
|
||||
|
||||
addRelationMorph: async function(params) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user