diff --git a/core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php b/core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php
index a5b901d50a65007e8677138e115d75d9396c4e37..5162aa12192b6fadb52b0ed7b0d37491313d5af2 100644
--- a/core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php
+++ b/core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php
@@ -36,7 +36,7 @@ public function __construct(EntityTypeInterface $entity_type, EntityStorageInter
    */
   protected function getWeight(EntityInterface $entity): int|float {
     /** @var \Drupal\Core\Config\Entity\ConfigEntityInterface $entity */
-    return $entity->get($this->weightKey);
+    return $entity->get($this->weightKey) ?: 0;
   }
 
   /**
diff --git a/core/modules/config/tests/src/Functional/ConfigDraggableListBuilderTest.php b/core/modules/config/tests/src/Functional/ConfigDraggableListBuilderTest.php
index 50f1650c9dd53f0794a0c75c70fc277866b45459..8688fc517ec92ce164bdfa128dd48ecc537788a7 100644
--- a/core/modules/config/tests/src/Functional/ConfigDraggableListBuilderTest.php
+++ b/core/modules/config/tests/src/Functional/ConfigDraggableListBuilderTest.php
@@ -59,6 +59,16 @@ public function testDraggableList() {
 
     $this->drupalGet('admin/people/roles');
     $this->assertSession()->responseContains('<td>' . Html::escape($role_name));
+
+    // Make sure that NULL weights do not break the list builder. Use the
+    // configuration API so that the value does not get type-casted according to
+    // the configuration schema.
+    \Drupal::configFactory()
+      ->getEditable('user.role.role_0')
+      ->set('weight', NULL)
+      ->save(TRUE);
+    $this->drupalGet('admin/people/roles');
+    $this->assertSession()->statusCodeEquals(200);
   }
 
 }