Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.582
diff -u -p -r1.582 theme.inc
--- includes/theme.inc	4 Mar 2010 09:03:08 -0000	1.582
+++ includes/theme.inc	16 Mar 2010 10:40:07 -0000
@@ -799,6 +799,7 @@ function theme($hook, $variables = array
   }
 
   $info = $hooks[$hook];
+  $info['hook'] = $hook;
   global $theme_path;
   $temp = $theme_path;
   // point path_to_theme() to the currently used theme path:
@@ -883,6 +884,18 @@ function theme($hook, $variables = array
     if (function_exists($info['function'])) {
       $output = $info['function']($variables);
     }
+    else {
+      watchdog('theme', 'Theme function "@function" not found.', array('@function' => $info['function']), WATCHDOG_WARNING);
+      // Fall back on the default theme function.
+      $default_function = 'theme_' . $info['hook'];
+      if (function_exists($default_function)) {
+        $output = $default_function($variables);
+      }
+      else {
+        watchdog('theme', 'Theme function "@function" not found.', array('@function' => $default_function), WATCHDOG_WARNING);
+        $output = '';
+      }
+    }
   }
   else {
     // Default render function and extension.
