diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index b157f1f..5f990ca 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -417,12 +417,6 @@ function user_format_name(AccountInterface $account) {
 function user_template_preprocess_default_variables_alter(&$variables) {
   $user = \Drupal::currentUser();
 
-  // If this function is called from the installer after Drupal has been
-  // installed then $user will not be set.
-  if (!is_object($user)) {
-    return;
-  }
-
   $variables['user'] = clone $user;
   // Remove password and session IDs, $form_state, since themes should not need nor see them.
   unset($variables['user']->pass, $variables['user']->sid, $variables['user']->ssid);
