? sites/all/modules/contrib
? sites/default/files
? sites/default/settings.php
Index: modules/book/book.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/book/book.admin.inc,v
retrieving revision 1.38
diff -u -p -r1.38 book.admin.inc
--- modules/book/book.admin.inc	20 Oct 2010 01:31:06 -0000	1.38
+++ modules/book/book.admin.inc	8 Nov 2010 04:17:35 -0000
@@ -124,6 +124,9 @@ function book_admin_edit_submit($form, &
       // Update the title if changed.
       if ($row['title']['#default_value'] != $values['title']) {
         $node = node_load($values['nid']);
+        if (!$node) {
+          continue;
+        }
         $langcode = LANGUAGE_NONE;
         $node->title = $values['title'];
         $node->book['link_title'] = $values['title'];
Index: modules/book/book.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/book/book.module,v
retrieving revision 1.555
diff -u -p -r1.555 book.module
--- modules/book/book.module	5 Nov 2010 19:47:20 -0000	1.555
+++ modules/book/book.module	8 Nov 2010 04:17:36 -0000
@@ -266,6 +266,9 @@ function book_block_view($delta = '') {
         $book['in_active_trail'] = FALSE;
         // Check whether user can access the book link.
         $book_node = node_load($book['nid']);
+        if (!$book_node) {
+          continue;
+        }
         $book['access'] = node_access('view', $book_node);
         $pseudo_tree[0]['link'] = $book;
         $book_menus[$book_id] = menu_tree_output($pseudo_tree);
@@ -883,6 +886,9 @@ function book_node_delete($node) {
       ));
       foreach ($result as $child) {
         $child_node = node_load($child->nid);
+        if (!$child_node) {
+          continue;
+        }
         $child_node->book['bid'] = $child_node->nid;
         _book_update_outline($child_node);
       }
Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.913
diff -u -p -r1.913 comment.module
--- modules/comment/comment.module	7 Nov 2010 21:46:09 -0000	1.913
+++ modules/comment/comment.module	8 Nov 2010 04:17:37 -0000
@@ -1426,6 +1426,9 @@ function comment_save($comment) {
     // Make sure we have a bundle name.
     if (!isset($comment->node_type)) {
       $node = node_load($comment->nid);
+      if (!$node) {
+        throw new Exception(t('Node %nid for comment %cid does not exist.', array('%nid' => $comment->nid, '%cid' => $comment->cid)));
+      }
       $comment->node_type = 'comment_node_' . $node->type;
     }
 
@@ -1755,8 +1758,9 @@ function comment_get_display_page($cid, 
  */
 function comment_edit_page($comment) {
   drupal_set_title(t('Edit comment %comment', array('%comment' => $comment->subject)), PASS_THROUGH);
-  $node = node_load($comment->nid);
-  return drupal_get_form("comment_node_{$node->type}_form", $comment);
+  if ($node = node_load($comment->nid)) {
+    return drupal_get_form("comment_node_{$node->type}_form", $comment);
+  }
 }
 
 /**
@@ -1808,6 +1812,9 @@ function comment_form($form, &$form_stat
   }
 
   $node = node_load($comment->nid);
+  if (!$node) {
+    return array();
+  }
   $form['#node'] = $node;
 
   // Use #comment-form as unique jump target, regardless of node type.
@@ -2008,7 +2015,7 @@ function comment_preview($comment) {
 
   $node = node_load($comment->nid);
 
-  if (!form_get_errors()) {
+  if ($node && !form_get_errors()) {
     $comment->format = $comment->comment_body[LANGUAGE_NONE][0]['format'];
     // Attach the user and time information.
     if (!empty($comment->name)) {
@@ -2155,7 +2162,7 @@ function comment_form_submit_build_comme
 function comment_form_submit($form, &$form_state) {
   $node = node_load($form_state['values']['nid']);
   $comment = $form['#builder_function']($form, $form_state);
-  if (user_access('post comments') && (user_access('administer comments') || $node->comment == COMMENT_NODE_OPEN)) {
+  if ($node && (user_access('post comments') && (user_access('administer comments') || $node->comment == COMMENT_NODE_OPEN))) {
     // Save the anonymous user information to a cookie for reuse.
     if (!$comment->uid) {
       user_cookie_save(array_intersect_key($form_state['values'], array_flip(array('name', 'mail', 'homepage'))));
@@ -2189,7 +2196,7 @@ function comment_form_submit($form, &$fo
     watchdog('content', 'Comment: unauthorized comment submitted or comment submitted to a closed post %subject.', array('%subject' => $comment->subject), WATCHDOG_WARNING);
     drupal_set_message(t('Comment: unauthorized comment submitted or comment submitted to a closed post %subject.', array('%subject' => $comment->subject)), 'error');
     // Redirect the user to the node they are commenting on.
-    $redirect = 'node/' . $node->nid;
+    $redirect = $node ? 'node/' . $node->nid : '<front>';
   }
   $form_state['redirect'] = $redirect;
   // Clear the block and page caches so that anonymous users see the comment
Index: modules/comment/comment.tokens.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.tokens.inc,v
retrieving revision 1.13
diff -u -p -r1.13 comment.tokens.inc
--- modules/comment/comment.tokens.inc	7 Jul 2010 17:00:42 -0000	1.13
+++ modules/comment/comment.tokens.inc	8 Nov 2010 04:17:38 -0000
@@ -193,17 +193,19 @@ function comment_tokens($type, $tokens, 
           break;
 
         case 'node':
-          $node = node_load($comment->nid);
-          $title = $node->title;
-          $replacements[$original] = $sanitize ? filter_xss($title) : $title;
+          if ($node = node_load($comment->nid)) {
+            $title = $node->title;
+            $replacements[$original] = $sanitize ? filter_xss($title) : $title;
+          }
           break;
       }
     }
 
     // Chained token relationships.
     if ($node_tokens = token_find_with_prefix($tokens, 'node')) {
-      $node = node_load($comment->nid);
-      $replacements += token_generate('node', $node_tokens, array('node' => $node), $options);
+      if ($node = node_load($comment->nid)) {
+        $replacements += token_generate('node', $node_tokens, array('node' => $node), $options);
+      }
     }
 
     if ($date_tokens = token_find_with_prefix($tokens, 'created')) {
Index: modules/node/node.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.admin.inc,v
retrieving revision 1.101
diff -u -p -r1.101 node.admin.inc
--- modules/node/node.admin.inc	20 Oct 2010 01:31:07 -0000	1.101
+++ modules/node/node.admin.inc	8 Nov 2010 04:17:38 -0000
@@ -288,10 +288,12 @@ function node_mass_update($nodes, $updat
  */
 function _node_mass_update_helper($nid, $updates) {
   $node = node_load($nid, NULL, TRUE);
-  foreach ($updates as $name => $value) {
-    $node->$name = $value;
+  if ($node) {
+    foreach ($updates as $name => $value) {
+      $node->$name = $value;
+    }
+    node_save($node);
   }
-  node_save($node);
   return $node;
 }
 
Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.1316
diff -u -p -r1.1316 node.module
--- modules/node/node.module	6 Nov 2010 23:24:33 -0000	1.1316
+++ modules/node/node.module	8 Nov 2010 04:17:41 -0000
@@ -110,8 +110,9 @@ function node_help($path, $arg) {
 
     case 'node/%/edit':
       $node = node_load($arg[1]);
-      $type = node_type_get_type($node);
-      return (!empty($type->help) ? '<p>' . filter_xss_admin($type->help) . '</p>' : '');
+      if ($node && ($type = node_type_get_type($node)) && !empty($type->help)) {
+        return '<p>' . filter_xss_admin($type->help) . '</p>';
+      }
   }
 
   if ($arg[0] == 'node' && $arg[1] == 'add' && $arg[2]) {
@@ -1212,8 +1213,9 @@ function node_delete_multiple($nids) {
 function node_revision_delete($revision_id) {
   if ($revision = node_load(NULL, $revision_id)) {
     // Prevent deleting the current revision.
+    // If the node is corrupt or otherwise incomplete, allow the deletion to continue.
     $node = node_load($revision->nid);
-    if ($revision_id == $node->vid) {
+    if ($node && $revision_id == $node->vid) {
       return FALSE;
     }
 
@@ -1622,6 +1624,9 @@ function node_search_execute($keys = NUL
   foreach ($find as $item) {
     // Render the node.
     $node = node_load($item->sid);
+    if (!$node) {
+      continue;
+    }
     $build = node_view($node, 'search_result');
     unset($build['#theme']);
     $node->rendered = drupal_render($build);
@@ -2587,7 +2592,12 @@ function node_update_index() {
  *   The node to index.
  */
 function _node_index_node($node) {
-  $node = node_load($node->nid);
+  $nid = $node->nid;
+  $node = node_load($nid);
+  if (!$node) {
+    search_reindex($nid, 'node');
+    return;
+  }
 
   // Save the changed time of the most recent indexed node, for the search
   // results half-life calculation.
Index: modules/node/node.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v
retrieving revision 1.134
diff -u -p -r1.134 node.pages.inc
--- modules/node/node.pages.inc	5 Nov 2010 19:47:20 -0000	1.134
+++ modules/node/node.pages.inc	8 Nov 2010 04:17:42 -0000
@@ -494,10 +494,15 @@ function node_delete_confirm($form, &$fo
  */
 function node_delete_confirm_submit($form, &$form_state) {
   if ($form_state['values']['confirm']) {
+    // The node object may be incomplete, or otherwise corrupt.  Allow the
+    // node to be deleted, but don't assume that all parts exist.
     $node = node_load($form_state['values']['nid']);
     node_delete($form_state['values']['nid']);
-    watchdog('content', '@type: deleted %title.', array('@type' => $node->type, '%title' => $node->title));
-    drupal_set_message(t('@type %title has been deleted.', array('@type' => node_type_get_name($node), '%title' => $node->title)));
+    $type = isset($node->type) ? $node->type : t('Unknown');
+    $type_name = isset($node->type) ? node_type_get_name($node) : t('Unknown');
+    $title = isset($node->title) ? $node->title : t('Unknown');
+    watchdog('content', '@type: deleted %title.', array('@type' => $type, '%title' => $title));
+    drupal_set_message(t('@type %title has been deleted.', array('@type' => $type_name, '%title' => $title)));
   }
 
   $form_state['redirect'] = '<front>';
Index: modules/poll/poll.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/poll/poll.module,v
retrieving revision 1.360
diff -u -p -r1.360 poll.module
--- modules/poll/poll.module	6 Nov 2010 23:24:33 -0000	1.360
+++ modules/poll/poll.module	8 Nov 2010 04:17:43 -0000
@@ -156,8 +156,7 @@ function poll_block_view($delta = '') {
 
     $record = $select->execute()->fetchObject();
     if ($record) {
-      $poll = node_load($record->nid);
-      if ($poll->nid) {
+      if ($poll = node_load($record->nid)) {
         $poll = poll_block_latest_poll_view($poll);
         $block['subject'] = t('Poll');
         $block['content'] = $poll->content;
@@ -940,20 +939,21 @@ function poll_cancel_form($form, &$form_
  */
 function poll_cancel($form, &$form_state) {
   global $user;
-  $node = node_load($form['#nid']);
 
-  db_delete('poll_vote')
-    ->condition('nid', $node->nid)
-    ->condition($user->uid ? 'uid' : 'hostname', $user->uid ? $user->uid : ip_address())
-    ->execute();
+  if ($node = node_load($form['#nid'])) {
+    db_delete('poll_vote')
+      ->condition('nid', $node->nid)
+      ->condition($user->uid ? 'uid' : 'hostname', $user->uid ? $user->uid : ip_address())
+      ->execute();
 
-  // Subtract from the votes.
-  db_update('poll_choice')
-    ->expression('chvotes', 'chvotes - 1')
-    ->condition('chid', $node->vote)
-    ->execute();
+    // Subtract from the votes.
+    db_update('poll_choice')
+      ->expression('chvotes', 'chvotes - 1')
+      ->condition('chid', $node->vote)
+      ->execute();
 
-  unset($_SESSION['poll_vote'][$node->nid]);
+  }
+  unset($_SESSION['poll_vote'][$form['#nid']]);
 
   drupal_set_message(t('Your vote was cancelled.'));
 }
Index: modules/profile/profile.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.module,v
retrieving revision 1.294
diff -u -p -r1.294 profile.module
--- modules/profile/profile.module	1 Oct 2010 15:24:18 -0000	1.294
+++ modules/profile/profile.module	8 Nov 2010 04:17:44 -0000
@@ -179,6 +179,9 @@ function profile_block_view($delta = '')
     $output = '';
     if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == NULL) {
       $node = node_load(arg(1));
+      if (!$node) {
+        return;
+      }
       $account = user_load($node->uid);
 
       if ($use_fields = variable_get('profile_block_author_fields', array())) {
Index: modules/search/search.api.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.api.php,v
retrieving revision 1.30
diff -u -p -r1.30 search.api.php
--- modules/search/search.api.php	27 Sep 2010 01:08:40 -0000	1.30
+++ modules/search/search.api.php	8 Nov 2010 04:17:44 -0000
@@ -222,6 +222,9 @@ function hook_search_execute($keys = NUL
   foreach ($find as $item) {
     // Build the node body.
     $node = node_load($item->sid);
+    if (!$node) {
+      continue;
+    }
     node_build_content($node, 'search_result');
     $node->body = drupal_render($node->content);
 
@@ -338,6 +341,9 @@ function hook_update_index() {
 
   foreach ($result as $node) {
     $node = node_load($node->nid);
+    if (!$node) {
+      continue;
+    }
 
     // Save the changed time of the most recent indexed node, for the search
     // results half-life calculation.
Index: modules/translation/translation.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/translation/translation.pages.inc,v
retrieving revision 1.16
diff -u -p -r1.16 translation.pages.inc
--- modules/translation/translation.pages.inc	17 Jul 2010 11:31:36 -0000	1.16
+++ modules/translation/translation.pages.inc	8 Nov 2010 04:17:44 -0000
@@ -33,6 +33,9 @@ function translation_node_overview($node
       // Existing translation in the translation set: display status.
       // We load the full node to check whether the user can edit it.
       $translation_node = node_load($translations[$language->language]->nid);
+      if (!$translation_node) {
+        continue;
+      }
       $title = l($translation_node->title, 'node/' . $translation_node->nid);
       if (node_access('update', $translation_node)) {
         $options[] = l(t('edit'), "node/$translation_node->nid/edit");
Index: modules/trigger/trigger.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/trigger/trigger.module,v
retrieving revision 1.65
diff -u -p -r1.65 trigger.module
--- modules/trigger/trigger.module	24 Sep 2010 00:37:44 -0000	1.65
+++ modules/trigger/trigger.module	8 Nov 2010 04:17:45 -0000
@@ -343,7 +343,8 @@ function trigger_node_delete($node) {
  *   The comment that was passed via the comment hook.
  *
  * @return
- *   The object expected by the action that is about to be called.
+ *   The object expected by the action that is about to be called, or FALSE if
+ *   the object cannot be loaded.
  */
 function _trigger_normalize_comment_context($type, $comment) {
   switch ($type) {
@@ -354,6 +355,9 @@ function _trigger_normalize_comment_cont
     // An action that works on users is being called in a comment context.
     case 'user':
       return user_load(is_array($comment) ? $comment['uid'] : $comment->uid);
+
+    default:
+      return $comment;
   }
 }
 
@@ -416,6 +420,9 @@ function _trigger_comment($a1, $hook) {
     if ($type != 'comment') {
       if (!isset($objects[$type])) {
         $objects[$type] = _trigger_normalize_comment_context($type, $a1);
+        if (!$objects[$type]) {
+          continue;
+        }
       }
       // Since we know about the comment, we pass it along to the action
       // in case it wants to peek at it.
@@ -456,7 +463,8 @@ function trigger_cron() {
  * @param $account
  *   The account object that was passed via the user hook.
  * @return
- *   The object expected by the action that is about to be called.
+ *   The object expected by the action that is about to be called, or FALSE
+ *   if the object cannot be loaded.
  */
 function _trigger_normalize_user_context($type, $account) {
   // Note that comment-type actions are not supported in user contexts,
@@ -470,6 +478,9 @@ function _trigger_normalize_user_context
         return node_load(array('nid' => arg(1)));
       }
       break;
+    default:
+      return $account;
+      break;
   }
 }
 
@@ -546,6 +557,9 @@ function _trigger_user($hook, &$edit, $a
     if ($type != 'user') {
       if (!isset($objects[$type])) {
         $objects[$type] = _trigger_normalize_user_context($type, $account);
+        if (!$objects[$type]) {
+          continue;
+        }
       }
       $context['user'] = $account;
       actions_do($aid, $objects[$type], $context);
