Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.751
diff -u -r1.751 common.inc
--- includes/common.inc	15 Jan 2008 08:13:40 -0000	1.751
+++ includes/common.inc	15 Jan 2008 23:11:44 -0000
@@ -3232,6 +3232,11 @@
     $update = array($update);
   }
 
+  $schema = drupal_get_schema($table);
+  if (empty($schema)) {
+    return FALSE;
+  }
+
   // Convert to an object if needed.
   if (is_array($object)) {
     $object = (object) $object;
@@ -3241,11 +3246,6 @@
     $array = FALSE;
   }
 
-  $schema = drupal_get_schema($table);
-  if (empty($schema)) {
-    return FALSE;
-  }
-
   $fields = $defs = $values = $serials = array();
 
   // Go through our schema, build SQL, and when inserting, fill in defaults for
@@ -3314,16 +3314,17 @@
         $object->$field = db_last_insert_id($table, $field);
       }
     }
+  }
+  else {
+    $return = FALSE;
+  }
 
-    // If we began with an array, convert back so we don't surprise the caller.
-    if ($array) {
-      $object = (array) $object;
-    }
-
-    return $return;
+  // If we began with an array, convert back so we don't surprise the caller.
+  if ($array) {
+    $object = (array) $object;
   }
 
-  return FALSE;
+  return $return;
 }
 
 /**
