From fb52cf40bc2c24c5dcff1b8cd348a571f30e2a35 Mon Sep 17 00:00:00 2001
From: Bram Driesen <4761-BramDriesen@users.noreply.drupalcode.org>
Date: Thu, 15 Dec 2022 09:14:26 +0100
Subject: [PATCH] Issue #3327245 by BramDriesen: Undefined array key 1
 cookiebot.install:44

---
 cookiebot.install | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/cookiebot.install b/cookiebot.install
index a7f9c4c..18dd7b3 100644
--- a/cookiebot.install
+++ b/cookiebot.install
@@ -41,6 +41,11 @@ function cookiebot_update_8003() {
 
   $path = \Drupal::service('path_alias.manager')->getPathByAlias($declaration_node_path);
   preg_match('/node\/(\d+)/', $path, $matches);
+
+  // Exit if we have no matches.
+  if (empty($matches) || empty($matches[1])) {
+    return;
+  }
   $node = \Drupal::entityTypeManager()->getStorage('node')->load($matches[1]);
   $config->set('cookiebot_show_declaration_node', $node->id());
   $config->clear('cookiebot_show_declaration_node_path');
-- 
GitLab