diff --git a/includes/theme.inc b/includes/theme.inc
index e6c1f596d69d0fd157b7285a3e8cef2859331584..da45df6dc5dc20797ad743c2f752482243c6e32e 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -2105,8 +2105,10 @@ function _template_preprocess_default_variables() {
     'logged_in' => FALSE,
   );
 
-  // The user object has no uid property when the database does not exist.
-  if (isset($user->uid)) {
+  // The user object has no uid property when the database does not exist during
+  // install. The user_access() check deals with issues when in maintenance mode
+  // as uid is set but the user.module has not been included.
+  if (isset($user->uid) && function_exists('user_access')) {
     $variables['is_admin'] = user_access('access administration pages');
     $variables['logged_in'] = ($user->uid > 0);
   }