diff --git a/core/lib/Drupal/Core/Extension/ThemeInstaller.php b/core/lib/Drupal/Core/Extension/ThemeInstaller.php
index db1226fa98..cb7aa2dd0f 100644
--- a/core/lib/Drupal/Core/Extension/ThemeInstaller.php
+++ b/core/lib/Drupal/Core/Extension/ThemeInstaller.php
@@ -220,9 +220,6 @@ public function uninstall(array $theme_list) {
     $theme_config = $this->configFactory->getEditable('system.theme');
     $list = $this->themeHandler->listInfo();
     foreach ($theme_list as $key) {
-      if (!isset($list[$key])) {
-        throw new \InvalidArgumentException("Unknown theme: $key.");
-      }
       if ($key === $theme_config->get('default')) {
         throw new \InvalidArgumentException("The current default theme $key cannot be uninstalled.");
       }
@@ -234,7 +231,7 @@ public function uninstall(array $theme_list) {
       // @todo https://www.drupal.org/node/474684 and
       //   https://www.drupal.org/node/1297856 themes should leverage the module
       //   dependency system.
-      if (!empty($list[$key]->sub_themes)) {
+      if (isset($list[$key]) && !empty($list[$key]->sub_themes)) {
         foreach ($list[$key]->sub_themes as $sub_key => $sub_label) {
           if (isset($list[$sub_key]) && !in_array($sub_key, $theme_list, TRUE)) {
             throw new \InvalidArgumentException("The base theme $key cannot be uninstalled, because theme $sub_key depends on it.");
