From dd6642453560380432d0bf461a79fe2451f71a26 Mon Sep 17 00:00:00 2001 From: catch <catch@35733.no-reply.drupal.org> Date: Tue, 23 May 2023 11:51:31 +0100 Subject: [PATCH] Issue #3278883 by vhin0210, longwave: TypeError: Argument 1 passed to Drupal\Core\Entity\EntityViewBuilder::view() must implement interface Drupal\Core\Entity\EntityInterface, null given, called in core/modules/node/node.module on line 559 --- core/modules/node/node.module | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/modules/node/node.module b/core/modules/node/node.module index ad1c8e96f365..bb59c5e0bfe2 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -586,9 +586,11 @@ function template_preprocess_node(&$variables) { // 'compact' view mode on the User entity. Note that the 'compact' // view mode might not be configured, so remember to always check the // theme setting first. - $variables['author_picture'] = \Drupal::entityTypeManager() - ->getViewBuilder('user') - ->view($node->getOwner(), 'compact'); + if ($node_owner = $node->getOwner()) { + $variables['author_picture'] = \Drupal::entityTypeManager() + ->getViewBuilder('user') + ->view($node_owner, 'compact'); + } } } } -- GitLab