diff --git a/src/Plugin/GraphQL/DataProducer/Entity/EntityLoad.php b/src/Plugin/GraphQL/DataProducer/Entity/EntityLoad.php index 765632a8c..d637a3a7c 100644 --- a/src/Plugin/GraphQL/DataProducer/Entity/EntityLoad.php +++ b/src/Plugin/GraphQL/DataProducer/Entity/EntityLoad.php @@ -161,8 +161,13 @@ public function resolve($type, $id, $language, ?array $bundles, ?bool $access, ? // Get the correct translation. if (isset($language) && $language !== $entity->language()->getId() && $entity instanceof TranslatableInterface) { - $entity = $entity->getTranslation($language); - $entity->addCacheContexts(["static:language:{$language}"]); + if ($entity->hasTranslation($language)) { + $entity = $entity->getTranslation($language); + $entity->addCacheContexts(["static:language:{$language}"]); + } + else { + return NULL; + } } // Check if the passed user (or current user if none is passed) has access