diff --git a/scheduler.module b/scheduler.module
index aeb1840..9cec851 100644
--- a/scheduler.module
+++ b/scheduler.module
@@ -738,43 +738,46 @@ function _scheduler_publish() {
 
   foreach ($nids as $nid) {
     $n = node_load($nid);
-    $n->changed = $n->publish_on;
-    $old_creation_date = $n->created;
-    if (variable_get('scheduler_publish_touch_'. $n->type, 0) == 1) {
-      $n->created = $n->publish_on;
-    }
+	// Fallback, if node does not exist.
+	if (!empty($n)) {
+	    $n->changed = $n->publish_on;
+	    $old_creation_date = $n->created;
+	    if (variable_get('scheduler_publish_touch_'. $n->type, 0) == 1) {
+	      $n->created = $n->publish_on;
+	    }
 
-    $create_publishing_revision = variable_get('scheduler_publish_revision_'. $n->type, 0) == 1;
-    if ($create_publishing_revision) {
-      $n->revision = TRUE;
-      $n->log = "Node published by scheduler module. Original creation date was ".  format_date($old_creation_date, 'custom', $date_format) .".";
-    }
+	    $create_publishing_revision = variable_get('scheduler_publish_revision_'. $n->type, 0) == 1;
+	    if ($create_publishing_revision) {
+	      $n->revision = TRUE;
+	      $n->log = "Node published by scheduler module. Original creation date was ".  format_date($old_creation_date, 'custom', $date_format) .".";
+	    }
 
-    // Use the actions system to publish the node.
-    watchdog('scheduler', '@type: scheduled publishing of %title.', array('@type' => $n->type, '%title' => $n->title), WATCHDOG_NOTICE, l(t('view'), 'node/'. $n->nid));
-    $actions = array('node_publish_action', 'node_save_action');
-    $context['node'] = $n;
-    actions_do($actions, $n, $context, NULL, NULL);
+	    // Use the actions system to publish the node.
+	    watchdog('scheduler', '@type: scheduled publishing of %title.', array('@type' => $n->type, '%title' => $n->title), WATCHDOG_NOTICE, l(t('view'), 'node/'. $n->nid));
+	    $actions = array('node_publish_action', 'node_save_action');
+	    $context['node'] = $n;
+	    actions_do($actions, $n, $context, NULL, NULL);
 
-    // If this node is not to be unpublished, then we can delete the record.
-    if (isset($n->unpublish_on) && $n->unpublish_on == 0) {
-      db_delete('scheduler')
-        ->condition('nid', $n->nid)
-        ->execute();
-    }
-    // We need to unpublish this node at some time so clear the publish on since
-    // it has been published.
-    else {
-      db_update('scheduler')
-        ->fields(array('publish_on' => 0))
-        ->condition('nid', $n->nid)
-        ->execute();
-    }
+	    // If this node is not to be unpublished, then we can delete the record.
+	    if (isset($n->unpublish_on) && $n->unpublish_on == 0) {
+	      db_delete('scheduler')
+	        ->condition('nid', $n->nid)
+	        ->execute();
+	    }
+	    // We need to unpublish this node at some time so clear the publish on since
+	    // it has been published.
+	    else {
+	      db_update('scheduler')
+	        ->fields(array('publish_on' => 0))
+	        ->condition('nid', $n->nid)
+	        ->execute();
+	    }
 
-    // Invoke scheduler API.
-    _scheduler_scheduler_api($n, 'publish');
+	    // Invoke scheduler API.
+	    _scheduler_scheduler_api($n, 'publish');
 
-    $result = TRUE;
+	    $result = TRUE;
+	} 
   }
 
   return $result;
