Fix undefined index notice on non-node pages

Fixes #95
This commit is contained in:
Oliver Davies 2020-06-01 11:48:55 +01:00
parent 1e78139333
commit 1207df285f

View file

@ -12,7 +12,7 @@ use Drupal\custom\Entity\Node\Post;
*/
function opdavies_preprocess_page(array &$variables): void {
/** @var \Drupal\custom\Entity\Node\Post $node */
if (!$node = $variables['node']) {
if (!$node = $variables['node'] ?? NULL) {
return;
}