From 4920c1fa76a7beb542f3db8ef14e3937d97cfed4 Mon Sep 17 00:00:00 2001 From: Kamal Bennani Date: Fri, 8 Jun 2018 20:27:45 +0200 Subject: [PATCH] Set the entry type only when the value is defined --- packages/strapi-plugin-graphql/services/GraphQL.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/strapi-plugin-graphql/services/GraphQL.js b/packages/strapi-plugin-graphql/services/GraphQL.js index 7fde6f9a9e..a85430cd70 100644 --- a/packages/strapi-plugin-graphql/services/GraphQL.js +++ b/packages/strapi-plugin-graphql/services/GraphQL.js @@ -533,7 +533,10 @@ module.exports = { const entry = withRelated && withRelated.toJSON ? withRelated.toJSON() : withRelated; - entry[association.alias]._type = _.upperFirst(association.model); + // Set the _type only when the value is defined + if (entry[association.alias]) { + entry[association.alias]._type = _.upperFirst(association.model); + } return entry[association.alias]; }