diff --git a/core/modules/block/block.module b/core/modules/block/block.module
index 2d40d78..4a4ae5a 100644
--- a/core/modules/block/block.module
+++ b/core/modules/block/block.module
@@ -6,12 +6,13 @@
  */
 
 use Drupal\block\BlockInterface;
+use Drupal\block\Entity\Block;
 use Drupal\Component\Utility\Html;
 use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\Core\Url;
 use Drupal\language\ConfigurableLanguageInterface;
+use Drupal\node\NodeTypeInterface;;
 use Drupal\system\Entity\Menu;
-use Drupal\block\Entity\Block;
 
 /**
  * Implements hook_help().
@@ -281,3 +282,20 @@ function block_configurable_language_delete(ConfigurableLanguageInterface $langu
     }
   }
 }
+
+/**
+ * Implements hook_node_type_delete().
+ *
+ * Delete the potential block visibility settings of the deleted node bundles.
+ */
+function block_node_type_delete(NodeTypeInterface $node_type) {
+  foreach (Block::loadMultiple() as $block) {
+    /** @var $block \Drupal\block\BlockInterface */
+    $visibility = $block->getVisibility();
+    if (isset($visibility['node_type']['bundles'][$node_type->id()])) {
+      unset($visibility['node_type']['bundles'][$node_type->id()]);
+      $block->setVisibilityConfig('node_type', $visibility['node_type']);
+      $block->save();
+    }
+  }
+}
diff --git a/core/modules/block/src/Tests/BlockTest.php b/core/modules/block/src/Tests/BlockTest.php
index 17fd982..405401b 100644
--- a/core/modules/block/src/Tests/BlockTest.php
+++ b/core/modules/block/src/Tests/BlockTest.php
@@ -7,8 +7,9 @@
 
 namespace Drupal\block\Tests;
 
-use Drupal\Component\Utility\Html;
 use Drupal\block\Entity\Block;
+use Drupal\Component\Utility\Html;
+use Drupal\node\Entity\NodeType;
 use Drupal\user\Entity\Role;
 use Drupal\user\RoleInterface;
 
@@ -480,4 +481,38 @@ public function testBlockUserRoleDelete() {
     ]);
   }
 
+  /**
+   * Tests block_node_type_delete.
+   */
+  public function testBlockNodeTypeDelete() {
+    $node_type1 = $this->drupalCreateContentType();
+    $node_type2 = $this->drupalCreateContentType();
+
+    $block = Block::create([
+      'id' => $this->randomMachineName(),
+      'plugin' => 'system_powered_by_block',
+    ]);
+
+    $block->setVisibilityConfig('node_type', [
+      'bundles' => [
+        $node_type1->id() => $node_type1->id(),
+        $node_type2->id() => $node_type2->id(),
+      ],
+    ]);
+
+    $block->save();
+
+    $this->assertEqual($block->getVisibility()['node_type']['bundles'], [
+      $node_type1->id() => $node_type1->id(),
+      $node_type2->id() => $node_type2->id()
+    ]);
+
+    $node_type1->delete();
+
+    $block = Block::load($block->id());
+    $this->assertEqual($block->getVisibility()['node_type']['bundles'], [
+      $node_type2->id() => $node_type2->id()
+    ]);
+  }
+
 }
diff --git a/core/modules/block/src/Tests/BlockTestBase.php b/core/modules/block/src/Tests/BlockTestBase.php
index c0d96ad..4168d7e 100644
--- a/core/modules/block/src/Tests/BlockTestBase.php
+++ b/core/modules/block/src/Tests/BlockTestBase.php
@@ -19,7 +19,7 @@
    *
    * @var array
    */
-  public static $modules = array('block', 'filter', 'test_page_test', 'help', 'block_test');
+  public static $modules = array('block', 'filter', 'test_page_test', 'help', 'block_test', 'node');
 
   /**
    * A list of theme regions to test.
