Index: modules/shortcut/shortcut.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/shortcut/shortcut.module,v
retrieving revision 1.24
diff -u -p -r1.24 shortcut.module
--- modules/shortcut/shortcut.module	6 Mar 2010 06:33:14 -0000	1.24
+++ modules/shortcut/shortcut.module	5 May 2010 18:35:57 -0000
@@ -625,7 +625,11 @@ function shortcut_renderable_links($shor
  * Implements hook_preprocess_page().
  */
 function shortcut_preprocess_page(&$variables) {
-  if (shortcut_set_edit_access()) {
+  // Only display the shortcut link if the user has the ability to edit
+  // shortcuts and if the page's actual content is being shown (for example,
+  // we do not want to display it on "access denied" or "page not found"
+  // pages).
+  if (shortcut_set_edit_access() && ($item = menu_get_item()) && $item['access']) {
     $link = $_GET['q'];
     $query_parameters = drupal_get_query_parameters();
     if (!empty($query_parameters)) {
