Problem/Motivation
When visiting certain views that are created dynamically or programmatically (not stored as configuration entities), the views_access_conditions module throws a fatal error in version 2.1.x:
Error: Call to a member function getThirdPartySettings() on null in Drupal\views_access_conditions\ViewsAlters->preBuildAlter() (line 189 of modules/contrib/views_access_conditions/src/ViewsAlters.php).
This occurs because the preBuildAlter() method attempts to load the view configuration entity without checking if it exists. When EntityStorageInterface::load() returns NULL (because the view doesn't exist as a stored configuration entity), the code proceeds to call getThirdPartySettings() on NULL, causing the fatal error.
Steps to reproduce
1. Install drupal/views_access_conditions version 2.1.x
2. Install a module that creates programmatic/dynamic views (e.g., drupal/trash)
3. Navigate to a programmatically-created view (e.g., /admin/content/trash)
4. Observe the fatal error
Proposed resolution
Add a null check after attempting to load the view configuration entity. If the view configuration doesn't exist, return early from the method.
Issue fork views_access_conditions-3572056
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
Comment #3
leoenriquezp commentedI just created a merge request and it's ready for review
Comment #4
leoenriquezp commentedComment #5
owenbush commentedThis looks good to me.
Comment #7
owenbush commentedMerged. Thank you.