diff --git a/includes/common.inc b/includes/common.inc
index ad2a345..16ea205 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -5155,6 +5155,9 @@
 }
 
 function _drupal_bootstrap_full() {
+  global $drupal_theme_init;
+  $drupal_theme_init=0;
+  
   static $called = FALSE;
 
   if ($called) {
@@ -5211,6 +5214,7 @@
     //   (e.g., hook_form_alter(), hook_node_view_alter(), hook_page_alter()),
     //   ahead of when rendering starts.
     menu_set_custom_theme();
+    $drupal_theme_init=1;
     drupal_theme_initialize();
     module_invoke_all('init');
   }
diff --git a/includes/theme.inc b/includes/theme.inc
index ed34b82..ccb0473 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -68,6 +68,10 @@
  * Initializes the theme system by loading the theme.
  */
 function drupal_theme_initialize() {
+  global $drupal_theme_init;
+  if (!$drupal_theme_init) {
+    return false;
+  }
   global $theme, $user, $theme_key;
 
   // If $theme is already set, assume the others are set, too, and do nothing
@@ -253,6 +257,10 @@
  *   class.
  */
 function theme_get_registry($complete = TRUE) {
+  global $drupal_theme_init;
+  if (!$drupal_theme_init) {
+    return false;
+  }
   // Use the advanced drupal_static() pattern, since this is called very often.
   static $drupal_static_fast;
   if (!isset($drupal_static_fast)) {
