diff --git a/core/modules/system/lib/Drupal/system/Plugin/Block/SystemHelpBlock.php b/core/modules/system/lib/Drupal/system/Plugin/Block/SystemHelpBlock.php
index f7b389d..e516c9c 100644
--- a/core/modules/system/lib/Drupal/system/Plugin/Block/SystemHelpBlock.php
+++ b/core/modules/system/lib/Drupal/system/Plugin/Block/SystemHelpBlock.php
@@ -92,15 +92,11 @@ public function access(AccountInterface $account) {
    */
   protected function getActiveHelp(Request $request) {
     $output = '';
-    $router_path = $request->attributes->get('_system_path');
-    // We will always have a path unless we are on a 403 or 404.
-    if (!$router_path) {
-      return '';
-    }
 
-    $arg = drupal_help_arg(explode('/', $router_path));
+    $arg = drupal_help_arg(explode('/', $request->attributes->get('_system_path')));
 
     foreach ($this->moduleHandler->getImplementations('help') as $module) {
+      $router_path = current_path();
       $function = $module . '_help';
       // Lookup help for this path.
       if ($help = $function($router_path, $arg)) {
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php b/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php
index 9a13acb..7d8c89b 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php
@@ -259,4 +259,16 @@ function testInvalidTheme() {
     $this->assertText(t('This theme requires the base theme @base_theme to operate correctly.', array('@base_theme' => 'not_real_test_basetheme')), 'Invalid base theme check succeeded.');
     $this->assertText(t('This theme requires the theme engine @theme_engine to operate correctly.', array('@theme_engine' => 'not_real_engine')), 'Invalid theme engine check succeeded.');
   }
+
+  /**
+   * Ensure that the help text block is hidden on a 404 page error.
+   */
+  function testThemeSettingsNotFoundHelpText() {
+    // Ensure invalid theme settings form URLs return a proper 404.
+    $this->drupalGet('admin/appearance/settings/' . $this->randomName());
+    $this->assertResponse(404, 'The theme settings form URL for a non-existent theme could not be found.');
+    // Ensure help block does not display.
+    $help_block = $this->xpath("//div[@id='block-help']");
+    $this->assertFalse($help_block, 'The help block is not displayed.');
+  }
 }
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index ee3466d..648d6f6 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -97,8 +97,11 @@ function system_help($path, $arg) {
       return $output;
     case 'admin/appearance/settings/' . $arg[3]:
       $theme_list = list_themes();
-      $theme = $theme_list[$arg[3]];
-      return '<p>' . t('These options control the display settings for the %name theme. When your site is displayed using this theme, these settings will be used.', array('%name' => $theme->info['name'])) . '</p>';
+      if (!empty($theme_list[$arg[3]])) {
+        $theme = $theme_list[$arg[3]];
+        return '<p>' . t('These options control the display settings for the %name theme. When your site is displayed using this theme, these settings will be used.', array('%name' => $theme->info['name'])) . '</p>';
+      }
+      break;
     case 'admin/appearance/settings':
       return '<p>' . t('These options control the default display settings for your entire site, across all themes. Unless they have been overridden by a specific theme, these settings will be used.') . '</p>';
     case 'admin/modules':
