diff --git a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php
index c660d20..acb6a46 100644
--- a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php
+++ b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php
@@ -394,7 +394,9 @@ public function calculateDependencies() {
 
     foreach ($this->options['value'] as $tid) {
       $term = $this->termStorage->load($tid);
-      $dependencies[$term->getConfigDependencyKey()][] = $term->getConfigDependencyName();
+      if ($term) {
+        $dependencies[$term->getConfigDependencyKey()][] = $term->getConfigDependencyName();
+      }
     }
 
     return $dependencies;
diff --git a/core/modules/taxonomy/src/Tests/Views/TaxonomyIndexTidUiTest.php b/core/modules/taxonomy/src/Tests/Views/TaxonomyIndexTidUiTest.php
index c2a0bcd..af69fd4 100644
--- a/core/modules/taxonomy/src/Tests/Views/TaxonomyIndexTidUiTest.php
+++ b/core/modules/taxonomy/src/Tests/Views/TaxonomyIndexTidUiTest.php
@@ -50,6 +50,9 @@ class TaxonomyIndexTidUiTest extends UITestBase {
   protected function setUp() {
     parent::setUp();
 
+    $this->adminUser = $this->drupalCreateUser(['administer taxonomy', 'administer views']);
+    $this->drupalLogin($this->adminUser);
+
     Vocabulary::create([
       'vid' => 'tags',
       'name' => 'Tags',
@@ -191,4 +194,15 @@ public function testExposedFilter() {
     $this->assertIdentical(1, count($xpath));
   }
 
+  /**
+  * Test taxonomy term id dependency.
+  */
+  public function testTaxonomyIndexTidContentDependencies() {
+    $this->drupalGet('admin/structure/views/view/test_filter_taxonomy_index_tid');
+    $this->drupalGet('/admin/structure/taxonomy/manage/tags/overview');
+    $this->drupalPostForm('/taxonomy/term/2/delete', NULL, t('Delete'));
+    $this->drupalPostForm('admin/structure/views/view/test_filter_taxonomy_index_tid', [], 'Save');
+    $this->assertText('The view test_filter_taxonomy_index_tid has been saved.');
+  }
+
 }
