Skip to content

Commit e395f63

Browse files
committed
Check for null eventinstance
1 parent 89adee1 commit e395f63

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

modules/access_events/src/Plugin/Block/EventInstanceSidebar.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ public function build() {
2626
$url = explode('/', $current_path);
2727
$event_instance_id = is_numeric($url[2]) ? $url[2] : '';
2828
$event_instance = \Drupal::entityTypeManager()->getStorage('eventinstance')->load($event_instance_id);
29+
30+
// Check if event instance exists before trying to get the series
31+
if (!$event_instance) {
32+
return [];
33+
}
34+
2935
$series = $event_instance->getEventSeries();
3036
$author = $series->getOwner();
3137
$current_user = \Drupal::currentUser();

0 commit comments

Comments
 (0)