Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291245

Call to a member function getDisplayname() on null in WorkspaceListBuilder.php on line 120

$
0
0

Problem/Motivation

The following code on the WorkspaceListBuilder.php is causing this problem.
'owner' => $entity->getOwner()->getDisplayName()
There is a chance to get a NULL value from the $entity->getOwner() function when there is no owner

Steps to reproduce

  • Create a workspace with any of the users as owner
  • Delete the user(workspace owner) using the following method "Delete the account and make its content belong to the Anonymous user."
  • Visit workspaces listing page(admin/config/workflow/workspaces)

Proposed resolution

Make sure the value of $entity->getOwner() is not null before calling the getDisplayName() function
eg :

   $owner = $entity->getOwner();
    if ($owner instanceof UserInterface) {
      // code
    }

User interface changes


Viewing all articles
Browse latest Browse all 291245

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>