Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.265.2.31
diff -u -p -r1.265.2.31 form.inc
--- includes/form.inc	7 Dec 2009 15:54:52 -0000	1.265.2.31
+++ includes/form.inc	27 Jan 2010 21:33:09 -0000
@@ -133,7 +133,7 @@ function drupal_get_form($form_id) {
   //
   // If $form_state['storage'] or $form_state['rebuild'] has been set
   // and the form has been submitted, we know that we're in a complex
-  // multi-part process of some sort and the form's workflow is NOT 
+  // multi-part process of some sort and the form's workflow is NOT
   // complete. We need to construct a fresh copy of the form, passing
   // in the latest $form_state in addition to any other variables passed
   // into drupal_get_form().
@@ -297,7 +297,7 @@ function drupal_execute($form_id, &$form
 
   // Make sure $form_state is passed around by reference.
   $args[1] = &$form_state;
-  
+
   $form = call_user_func_array('drupal_retrieve_form', $args);
   $form['#post'] = $form_state['values'];
   drupal_prepare_form($form_id, $form, $form_state);
@@ -762,8 +762,8 @@ function form_execute_handlers($type, &$
 
   foreach ($handlers as $function) {
     if (function_exists($function))  {
-      // Check to see if a previous _submit handler has set a batch, but 
-      // make sure we do not react to a batch that is already being processed 
+      // Check to see if a previous _submit handler has set a batch, but
+      // make sure we do not react to a batch that is already being processed
       // (for instance if a batch operation performs a drupal_execute()).
       if ($type == 'submit' && ($batch =& batch_get()) && !isset($batch['current_set'])) {
         // Some previous _submit handler has set a batch. We store the call
@@ -802,10 +802,15 @@ function form_set_error($name = NULL, $m
     $form = array();
   }
   if (isset($name) && !isset($form[$name])) {
-    $form[$name] = $message;
     if ($message) {
       drupal_set_message($message, 'error');
     }
+    else {
+      // If the message is empty, save a default message. This is needed for
+      // _form_set_class() which tests whether the returned value is empty.
+      $message = t('Error in @name field.', array('@name' => $name));
+    }
+    $form[$name] = $message;
   }
   return $form;
 }
