From 59c6b12b3f489e5a0cc8dd1b2b6369eb6cf3b032 Mon Sep 17 00:00:00 2001
From: Kristen Pol <kristen.pol@gmail.com>
Date: Fri, 28 Feb 2025 18:29:53 -0800
Subject: [PATCH] Check for null block.

---
 includes/system_branding.inc | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/includes/system_branding.inc b/includes/system_branding.inc
index 62e1bdb2..11ab6aa0 100644
--- a/includes/system_branding.inc
+++ b/includes/system_branding.inc
@@ -24,7 +24,13 @@ function civictheme_preprocess_block__system_branding_block(array &$variables):
   $variables['show_site_name'] = !empty($variables['elements']['#configuration']['use_site_name']);
   $variables['show_site_slogan'] = !empty($variables['elements']['#configuration']['use_site_slogan']);
 
-  $is_footer_region = !empty($variables['elements']['#id']) && str_starts_with(Block::load($variables['elements']['#id'])->getRegion(), 'footer');
+  $is_footer_region = false;
+  if (!empty($variables['elements']['#id'])) {
+    $block = Block::load($variables['elements']['#id']);
+    if ($block) {
+      $is_footer_region = str_starts_with($block->getRegion(), 'footer');
+    }
+  }
 
   $theme = $is_footer_region
     ? civictheme_get_theme_config_manager()->load('components.footer.theme', CivicthemeConstants::FOOTER_THEME_DEFAULT)
-- 
GitLab