diff --git a/template.php b/template.php
index 0aa16ebeaf3a300125f9a4da7953abc73b0165ed..fce513658ef11b2b3afe5e770c9be1e6d55842ec 100644
--- a/template.php
+++ b/template.php
@@ -694,19 +694,26 @@ function cambridge_theme_block_view_alter(&$data, $block) {
  * Cycle through a tree and make items marked as faux active as actually active.
  */
 function _cambridge_theme_add_active_item($items) {
+  if (!is_array($items)) {
+    return $items; // Return as-is if not an array
+  }
+
   foreach ($items as $key => $item) {
-    if (FALSE === is_int($key)) {
+    if (!is_int($key)) {
       continue;
     }
 
     if (
-      isset($item['#original_link']['cambridge_theme_faux_active'])
-      &&
-      FALSE === in_array('active', $item['#attributes']['class'])
+      isset($item['#original_link']['cambridge_theme_faux_active']) &&
+      !in_array('active', $item['#attributes']['class'] ?? [])
     ) {
       $items[$key]['#attributes']['class'][] = 'active';
     }
-    $items[$key]['#below'] = _cambridge_theme_add_active_item($items[$key]['#below']);
+
+    // Ensure '#below" exists and is an array
+    if (isset($items[$key]['#below']) && is_array($items[$key]['#below'])) {
+      $items[$key]['#below'] = _cambridge_theme_add_active_item($items[$key]['#below']);
+    }
   }
 
   return $items;