diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php b/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php
index bf4979b..6eef193 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php
@@ -136,8 +136,8 @@ public function viewElements(FieldItemListInterface $items) {
           comment_prepare_thread($comments);
           $build = $this->viewBuilder->viewMultiple($comments);
           $build['pager']['#theme'] = 'pager';
-          if (!empty($this->settings['pager_id'])) {
-            $build['pager']['#element'] = $this->settings['pager_id'];
+          if ($this->getSetting('pager_id')) {
+            $build['pager']['#element'] = $this->getSetting('pager_id');
           }
           $output['comments'] = $build;
         }
