Index: CHANGELOG.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/themesettingsapi/CHANGELOG.txt,v
retrieving revision 1.1.6.9
diff -u -p -r1.1.6.9 CHANGELOG.txt
--- CHANGELOG.txt	10 Dec 2007 06:46:45 -0000	1.1.6.9
+++ CHANGELOG.txt	13 Dec 2007 22:38:50 -0000
@@ -1,3 +1,6 @@
+Theme Settings API 5.x-2.7
+  #199635: WSOD (white screen of death) on cached pages
+
 Theme Settings API 5.x-2.6
   #198819: Fixed incompatibility with i18n module (since 5.x-2.4)
 
Index: themesettingsapi.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/themesettingsapi/themesettingsapi.module,v
retrieving revision 1.1.6.7
diff -u -p -r1.1.6.7 themesettingsapi.module
--- themesettingsapi.module	10 Dec 2007 06:43:52 -0000	1.1.6.7
+++ themesettingsapi.module	13 Dec 2007 22:38:50 -0000
@@ -17,19 +17,29 @@
 
 /**
  * Implementation of hook_init().
+ *
+ * Note that arg() is not available for cached pages.
  */
 function themesettingsapi_init() {
+  global $user;
+
   // Conditionally load on admin/build/themes/settings/* and admin/settings/admin
-  if (arg(0) == 'admin'
+  if (!empty($user->uid) // Not needed for anonymous users or cached pages
+      && arg(0) == 'admin'
       && (arg(4) != '' && arg(2) == 'themes' && arg(3) == 'settings' && arg(1) == 'build'
           || arg(2) == 'admin' && arg(1) == 'settings')) {
     include_once('./'. drupal_get_path('module', 'themesettingsapi') .'/themesettingsapi.admin.inc');
   }
 
   // Conditionally load the admin theme on node/add/* and node/*/edit
-  if (variable_get('node_admin_theme', '0') && arg(0) == 'node' && (arg(1) == 'add' || arg(2) == 'edit')) {
-    global $custom_theme;
-    $custom_theme = variable_get('admin_theme', '0');
-    drupal_add_css(drupal_get_path('module', 'system') .'/admin.css', 'module');
+  if (variable_get('node_admin_theme', '0') && !empty($_GET['q'])) {
+    // arg() is not available to cached pages
+    $arg = explode('/', $_GET['q']);
+    if ($arg[0] == 'node' && ($arg[1] == 'add' || $arg[2] == 'edit')) {
+      require_once './includes/common.inc';
+      global $custom_theme;
+      $custom_theme = variable_get('admin_theme', '0');
+      drupal_add_css(drupal_get_path('module', 'system') .'/admin.css', 'module');
+    }
   }
 }
