From 489c9d5e035ae6db0ac0159825078ee9cc65129e Mon Sep 17 00:00:00 2001 From: David Blankenship Date: Mon, 30 Sep 2024 09:23:04 -0400 Subject: [PATCH] chore(YSP-689): fix null error on views --- .../custom/ys_views_basic/src/ViewsBasicManager.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php index f9806fea2..70946cd61 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php @@ -441,10 +441,12 @@ public function getView($type, $params) { // This ensures that if the options for showing categories, tags, // or thumbnails change, the cache will be invalidated, // and the view will be re-rendered with the new options. - foreach ($view['#rows']['#rows'] as &$resultRow) { - $resultRow['#cache']['keys'][] = $field_display_options['show_categories']; - $resultRow['#cache']['keys'][] = $field_display_options['show_tags']; - $resultRow['#cache']['keys'][] = $field_display_options['show_thumbnail']; + if ($view['#rows'] && $view['#rows']['#rows']) { + foreach ($view['#rows']['#rows'] as &$resultRow) { + $resultRow['#cache']['keys'][] = $field_display_options['show_categories']; + $resultRow['#cache']['keys'][] = $field_display_options['show_tags']; + $resultRow['#cache']['keys'][] = $field_display_options['show_thumbnail']; + } } break;