diff --git a/src/Entity/Index.php b/src/Entity/Index.php
index baf42e23..42ec2626 100644
--- a/src/Entity/Index.php
+++ b/src/Entity/Index.php
@@ -1015,8 +1015,11 @@ class Index extends ConfigEntityBase implements IndexInterface {
    * {@inheritdoc}
    */
   public function getPropertyDefinitions($datasource_id) {
-    if (!isset($this->properties[$datasource_id])) {
-      if (isset($datasource_id)) {
+    // Normalize NULL to empty string for array key.
+    $key = $datasource_id ?? '';
+
+    if (!isset($this->properties[$key])) {
+      if ($datasource_id !== NULL) {
         $datasource = $this->getDatasource($datasource_id);
         $properties = $datasource->getPropertyDefinitions();
       }
@@ -1029,10 +1032,10 @@ class Index extends ConfigEntityBase implements IndexInterface {
         $properties += $processor->getPropertyDefinitions($datasource);
       }
 
-      $this->properties[$datasource_id] = $properties;
+      $this->properties[$key] = $properties;
     }
 
-    return $this->properties[$datasource_id];
+    return $this->properties[$key];
   }
 
   /**
