Problem / Motivation
On drupal/webform version 5.2.0 and Drupal 8.8.8.
If you are rendering entities in a search index, you may see this error on index:
InvalidArgumentException while trying to render item (entityidhere) with view mode full for search index Acquia Search Solr Index: Route required in Drupal\Core\Url::fromRouteMatch()
The error is happening because modules/webform_access/src/Breadcrumb/WebformAccessBreadcrumbBuilder.php calls Url::fromRouteMatch($route_match) but $route_match does not have a route object.
Proposed Resolution
Add a condition to check for the route object. If the route object does not exist, do not render a link.
Comments
Comment #2
josephdpurcell commentedThe attached patch resolves the issue. I did not test to confirm there are not negative side-effects of this.
Comment #3
josephdpurcell commentedThis patch at least solves the immediate issue seen on index. This should get reviewed to make sure its not causing bad behavior elsewhere.
Comment #4
josephdpurcell commentedAdding issues in other modules and code that cause issues due to fromRouteMatch() throwing an exception.
Comment #5
jrockowitz commented@josephdpurcell I hope all is well with you. Thanks for the patch.