When saving an entity with an empty section field, user without "bypass workbench access" permission gets fatal error
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #2938432. --> Reported by: [acbramley](https://www.drupal.org/user/1036766) >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>This happens on both node save, and when adding a paragraph to a ERR field on a node.</p> <p>When a user without the "bypass workbench access" permission attempts to save (I presume any) entity, with a section field that is empty a fatal error occurs:</p> <pre> TypeError: Argument 1 passed to Drupal\\workbench_access\\AccessControlHierarchyBase::checkEntityAccess() must implement interface Drupal\\Core\\Entity\\EntityInterface, null given, called in /data/app/modules/contrib/entity_hierarchy/modules/entity_hierarchy_workbench_access/src/Plugin/Validation/Constraint/ValidEntityHierarchySection.php on line 62</pre><p> This is due to <code>$parent = $items-&gt;entity;</code> assuming that a value is returned.</p> <p>This also seems to occur when adding a new paragraph to an entity reference revisions field.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Add the violation if the field is empty and the "Deny access to unassigned content" flag is checked.</p>
issue