Skip to content

Call to a member function hasField() on null #5

Description

@scottsawyer

Given a URL like /products/industrial-vacuum-cleaners/f/cfm/over-250/product-category/soot-collection/vacuum-type/[back] it can throw an error

Error: Call to a member function hasField() on null in Drupal\facets_hardcode\FacetsHardcodeSlugHelper::getSlugFromValue() (line 53 of /code/web/modules/contrib/facets_hardcode/src/FacetsHardcodeSlugHelper.php).

Backtrace

#0 /code/web/modules/contrib/facets_hardcode/src/FacetsHardcodePathHelper.php(156): Drupal\facets_hardcode\FacetsHardcodeSlugHelper::getSlugFromValue('vacuum-type', '[back]')
#1 /code/web/modules/contrib/facets_hardcode/src/Plugin/facets/url_processor/FacetsHardcodeUrlProcessor.php(90): Drupal\facets_hardcode\FacetsHardcodePathHelper::updateFilterString(Object(Drupal\facets\Entity\Facet), Object(Drupal\facets\Result\Result), '/industrial-vac...')
#2 /code/web/modules/contrib/facets/src/Plugin/facets/processor/UrlProcessorHandler.php(76): Drupal\facets_hardcode\Plugin\facets\url_processor\FacetsHardcodeUrlProcessor->buildUrls(Object(Drupal\facets\Entity\Facet), Array)

FacetsHardcodeSlugHelper::getSlugFromValue doesn't properly check if an entity is found before attempting to generate the slug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions