Problem/Motivation

Using an announcement type with no conditions breaks the announcement list page with the error Call to a member function getValue() on null in Drupal\announcements\AnnouncementListBuilder->buildRow()

Steps to reproduce

  1. Install the announcements module.
  2. Create an announcement of type Default.
  3. Visit /announcements.

Proposed resolution

Add null checks when attempting to load the visibility rules in AnnouncementListBuilder.

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

jamosmk7 created an issue. See original summary.

jamosmk7’s picture

jamosmk7’s picture

Status: Active » Needs review

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

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

neclimdul’s picture

Extended this fix to the access control class which has the same logic and ported the patch to a merge request.

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

richgerdes’s picture

I like the solution here, but as a better idea, I think moving this to a function would make things clearer. I've updated the PR to provide helper functions for creating the plugins and validating the configs. This should make it more straight forward, and prevent issues in the future.

richgerdes’s picture

Status: Needs review » Fixed

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

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

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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