Index: domain.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/domain/domain.module,v
retrieving revision 1.237
diff -u -p -r1.237 domain.module
--- domain.module	16 Jan 2011 17:30:59 -0000	1.237
+++ domain.module	27 Jan 2011 23:20:30 -0000
@@ -1598,10 +1598,15 @@ function domain_get_node_match($nid) {
   // Load the domain data for this node -- but only take the first match.
   $id = db_query("SELECT gid FROM {domain_access} WHERE nid = :nid AND realm = :realm ORDER BY gid", array(':nid' => $nid, ':realm' => 'domain_id'))->fetchField();
 
-  // Now find the proper source domain.
-  $source = domain_lookup($id);
-  drupal_alter('domain_source', $source, $nid);
-  $domain[$nid] = $source;
+  // If a match was found, return it. Otherwise, we may be saving a node
+  // in which case, let it fall through. See http://drupal.org/node/624360.
+  $source = NULL;
+  if ($id !== FALSE) {
+    $source = domain_lookup($id);
+    drupal_alter('domain_source', $source, $nid);
+    $domain[$nid] = $source;
+  }
+
   return $source;
 }
 
