Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.511
diff -u -p -r1.511 form.inc
--- includes/form.inc	17 Nov 2010 04:10:51 -0000	1.511
+++ includes/form.inc	27 Nov 2010 17:08:39 -0000
@@ -150,6 +150,15 @@
  */
 
 /**
+ * Exception class for the Form API.
+ *
+ * Identical to the base Exception class, merely providing a more specific name,
+ * so callers can catch Form API exceptions and treat them differently.
+ */
+class FormException extends Exception {
+}
+
+/**
  * Wrapper for drupal_build_form() for use when $form_state is not needed.
  *
  * @param $form_id
@@ -702,7 +711,11 @@ function drupal_retrieve_form($form_id, 
 
   // If $callback was returned by a hook_forms() implementation, call it.
   // Otherwise, call the function named after the form id.
-  $form = call_user_func_array(isset($callback) ? $callback : $form_id, $args);
+  $callback = (isset($callback) ? $callback : $form_id);
+  if (!function_exists($callback)) {
+    throw new FormException(t('Form constructor %callback not found.', array('%callback' => $callback)));
+  }
+  $form = call_user_func_array($callback, $args);
   $form['#form_id'] = $form_id;
 
   return $form;
