Call to a member function toUrl() on null in Drupal\view_mode_page\Controller\MainController->displayEntity()

Created on 9 July 2024, 5 months ago

Problem/Motivation

I get the following error resulting in a page that is not working, Call to a member function toUrl() on null in Drupal\view_mode_page\Controller\MainController->displayEntity() this is because the code always thinks the entity is of type EntityInterface but it could also be the case where it is now referencing an removed entity resulting in NULL, and then resulting in an error when trying to fetch on to URL on null.

Steps to reproduce

Make sure that the entity referenced is invalid. Then get the error stating Call to a member function toUrl() on null in Drupal\view_mode_page\Controller\MainController->displayEntity()

Proposed resolution

Apply patch making sure that it can never break.

Remaining tasks

Review the code see if everthing keeps working as aspected.

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Needs review

Version

4.0

Component

Code

Created by

🇳🇱Netherlands Remco Hoeneveld

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024