diff --git a/advanced_help.module b/advanced_help.module
index ad55411..0023c3a 100644
--- a/advanced_help.module
+++ b/advanced_help.module
@@ -482,11 +482,6 @@ function theme_advanced_help_topic($variables) {
   $topic  = $variables['topic'];
   $type   = $variables['type'];
 
-  $info = advanced_help_get_topic($module, $topic);
-  if (!$info) {
-    return;
-  }
-
   switch ($type) {
     case 'icon':
       $text = '<span>' . t('Help') . '</span>';
@@ -504,26 +499,32 @@ function theme_advanced_help_topic($variables) {
       break;
   }
 
+  $attributes = array(
+    'attributes' => array(
+      'class' => $class,
+      'title' => 'Advanced Help Index',
+    ),
+    'html' => TRUE
+  );
+
+  if (!$topic) {
+    return l($text, 'admin/advanced_help', $attributes);
+  }
+
+  if (!$info = advanced_help_get_topic($module, $topic)) {
+    return;
+  }
+
+  $attributes['attributes']['title'] = $info['title'];
+
   if (user_access('view advanced help popup')) {
     drupal_add_css(drupal_get_path('module', 'advanced_help') . '/help-icon.css');
-    return l($text, "help/$module/$topic", array(
-      'attributes' => array(
-        'class' => $class,
-        'onclick' => "var w=window.open(this.href, 'advanced_help_window', 'width=" . $info['popup width'] . ",height=" . $info['popup height'] . ",scrollbars,resizable'); w.focus(); return false;",
-        'title' => $info['title']
-      ),
-      'query' => array('popup' => TRUE),
-      'html' => TRUE)
-    );
+    $attributes['attributes']['onclick'] = "var w=window.open(this.href, 'advanced_help_window', 'width=" . $info['popup width'] . ",height=" . $info['popup height'] . ",scrollbars,resizable'); w.focus(); return false;";
+    $attributes['query'] = array('popup' => TRUE);
+    return l($text, "help/$module/$topic", $attributes);
   }
   else {
-    return l($text, "help/$module/$topic", array(
-      'attributes' => array(
-        'class' => $class,
-        'title' => $info['title']
-      ),
-      'html' => TRUE)
-    );
+    return l($text, "help/$module/$topic", $attributes);
   }
 }
 
