Index: domain.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/domain/domain.install,v
retrieving revision 1.16
diff -u -p -r1.16 domain.install
--- domain.install	18 Oct 2008 16:49:18 -0000	1.16
+++ domain.install	20 Feb 2009 16:14:57 -0000
@@ -144,3 +144,14 @@ function domain_update_6200() {
   }
   return $ret;
 }
+
+/**
+ * Updates to 6.x.2.
+ *
+ * Deletes entries from {domain_editor} for domains that no longer exist.
+ */
+function domain_update_6201() {
+  $ret = array();
+  db_query("DELETE FROM {domain_editor} WHERE NOT EXISTS (SELECT domain_id FROM {domain} WHERE {domain}.domain_id={domain_editor}.domain_id)");
+  return $ret;
+}
Index: domain.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/domain/domain.module,v
retrieving revision 1.89
diff -u -p -r1.89 domain.module
--- domain.module	16 Feb 2009 21:58:04 -0000	1.89
+++ domain.module	20 Feb 2009 16:14:58 -0000
@@ -1438,6 +1438,7 @@ function domain_domainupdate($op, $domai
         // Remove domain-specific entries from the {node_access} table and clear the cache.
         db_query("DELETE FROM {node_access} WHERE realm = '%s' AND gid = %d", 'domain_id', $domain['domain_id']);
         db_query("DELETE FROM {domain_access} WHERE realm = '%s' AND gid = %d", 'domain_id', $domain['domain_id']);
+        db_query("DELETE FROM {domain_editor} WHERE domain_id = %d", $domain['domain_id']);
       }
       break;
   }
