--- node.module.orig	2008-04-15 11:32:08.000000000 +0200
+++ node.module	2008-04-15 11:35:05.000000000 +0200
@@ -513,26 +513,29 @@
     if ($cachable && isset($nodes[$param])) {
       return is_object($nodes[$param]) ? drupal_clone($nodes[$param]) : $nodes[$param];
     }
-    $cond = 'n.nid = %d';
+    $cond = ' WHERE n.nid = %d';
     $arguments[] = $param;
   }
-  else {
+  else if (is_array($param)) {
     // Turn the conditions into a query.
     foreach ($param as $key => $value) {
       $cond[] = 'n.'. db_escape_string($key) ." = '%s'";
       $arguments[] = $value;
     }
-    $cond = implode(' AND ', $cond);
+    $cond = ' WHERE '.implode(' AND ', $cond);
+  }
+  else {
+    return NULL;
   }
 
   // Retrieve the node.
   // No db_rewrite_sql is applied so as to get complete indexing for search.
   if ($revision) {
     array_unshift($arguments, $revision);
-    $node = db_fetch_object(db_query('SELECT n.nid, r.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.nid = n.nid AND r.vid = %d WHERE '. $cond, $arguments));
+    $node = db_fetch_object(db_query('SELECT n.nid, r.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.nid = n.nid AND r.vid = %d '. $cond, $arguments));
   }
   else {
-    $node = db_fetch_object(db_query('SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.vid = n.vid WHERE '. $cond, $arguments));
+    $node = db_fetch_object(db_query('SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.vid = n.vid '. $cond, $arguments));
   }
 
   if ($node->nid) {
