Problem/Motivation

Avoid an exception thrown when a source entity cannot be loaded in service Usage::detailedUsage.

The website encountered an unexpected error. Please try again later.
Error: Call to a member function hasLinkTemplate() on null in Drupal\entity_usage_addons\Service\Usage->detailedUsage() (line 131 of modules/contrib/entity_usage_addons/src/Service/Usage.php).

Proposed resolution

Add a check right after the entity is loaded before accessing entity methods and attributes.

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

missvengerberg created an issue. See original summary.

missvengerberg’s picture

Here's the patch:

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

abhishek_gupta1’s picture

Status: Needs review » Reviewed & tested by the community

above patch fixed the issue, also I created MR, moving RTBC++

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

malcomio’s picture

Status: Reviewed & tested by the community » Fixed

Thanks

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.