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.

CommentFileSizeAuthor
added-fix-for-view-mode.patch1.05 KBremco hoeneveld
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Remco Hoeneveld created an issue. See original summary.

rishabjasrotia made their first commit to this issue’s fork.

rishabjasrotia’s picture

Status: Active » Needs review