diff -u b/core/modules/shortcut/lib/Drupal/shortcut/ShortcutStorageController.php b/core/modules/shortcut/lib/Drupal/shortcut/ShortcutStorageController.php --- b/core/modules/shortcut/lib/Drupal/shortcut/ShortcutStorageController.php +++ b/core/modules/shortcut/lib/Drupal/shortcut/ShortcutStorageController.php @@ -22,15 +22,13 @@ parent::attachLoad($queried_entities, $revision_id); foreach ($queried_entities as $id => $entity) { + // Ensure that the links property exists even if the menu has no links. + $entity->links = array(); $links = menu_load_links('shortcut-' . $id); foreach ($links as $menu_link) { $entity->links[$menu_link->uuid()] = $menu_link; } } - // Ensure that links is an empty array. - if (!property_exists($entity, 'links')) { - $entity->links = array(); - } }