--- src/core/download_list.cc	2010-04-24 18:22:57.594809355 -0500
+++ src/core/download_list.cc.new	2010-04-24 18:23:36.251809545 -0500
@@ -598,6 +598,9 @@
   // up/downloaded baseline.
   download->download()->tracker_list()->send_completed();
 
+  // save the hash in case the event deletes the object (e.g. d.erase)
+  torrent::HashString infohash = download->info()->hash();
+
   rpc::commands.call_catch("event.download.finished", rpc::make_target(download), torrent::Object(), "Download event action failed: ");
 
 //   if (download->resume_flags() != ~uint32_t())
@@ -613,8 +616,11 @@
   // being hashed.
   download->set_resume_flags(~uint32_t());
 
-  if (!download->is_active() && rpc::call_command_value("d.state", rpc::make_target(download)) == 1)
-    resume(download, torrent::Download::start_no_create | torrent::Download::start_skip_tracker | torrent::Download::start_keep_baseline);
+  if (find(infohash) != end()) {
+  	if (!download->is_active() && rpc::call_command_value("d.get_state", rpc::make_target(download)) == 1)
+	  resume(download, torrent::Download::start_no_create | torrent::Download::start_skip_tracker | torrent::Download::start_keep_baseline);
+  }
+
 }
 
 void

