diff --git a/core/modules/user/src/Plugin/views/filter/Roles.php b/core/modules/user/src/Plugin/views/filter/Roles.php
index a6986f2..a07f64b 100644
--- a/core/modules/user/src/Plugin/views/filter/Roles.php
+++ b/core/modules/user/src/Plugin/views/filter/Roles.php
@@ -88,8 +88,9 @@ public function calculateDependencies() {
     }
 
     foreach ((array) $this->value as $role_id) {
-      $role = $this->roleStorage->load($role_id);
-      $dependencies[$role->getConfigDependencyKey()][] = $role->getConfigDependencyName();
+      if ($role = $this->roleStorage->load($role_id)) {
+        $dependencies[$role->getConfigDependencyKey()][] = $role->getConfigDependencyName();
+      }
     }
     return $dependencies;
   }
