diff --git a/core/modules/image/image.module b/core/modules/image/image.module
index 807b58c33a..d5f5312637 100644
--- a/core/modules/image/image.module
+++ b/core/modules/image/image.module
@@ -252,48 +252,56 @@ function image_style_options($include_empty = TRUE) {
 function template_preprocess_image_style(&$variables) {
   $style = ImageStyle::load($variables['style_name']);
 
-  // Determine the dimensions of the styled image.
-  $dimensions = [
-    'width' => $variables['width'],
-    'height' => $variables['height'],
-  ];
-
-  $style->transformDimensions($dimensions, $variables['uri']);
-
-  $variables['image'] = [
-    '#theme' => 'image',
-    '#width' => $dimensions['width'],
-    '#height' => $dimensions['height'],
-    '#attributes' => $variables['attributes'],
-    '#style_name' => $variables['style_name'],
-  ];
-
-  // If the current image toolkit supports this file type, prepare the URI for
-  // the derivative image. If not, just use the original image resized to the
-  // dimensions specified by the style.
-  if ($style->supportsUri($variables['uri'])) {
-    $variables['image']['#uri'] = $style->buildUrl($variables['uri']);
-  }
-  else {
-    $variables['image']['#uri'] = $variables['uri'];
-    // Don't render the image by default, but allow other preprocess functions
-    // to override that if they need to.
-    $variables['image']['#access'] = FALSE;
-
+  if (!$style) {
     // Inform the site builders why their image didn't work.
-    \Drupal::logger('image')->warning('Could not apply @style image style to @uri because the style does not support it.', [
-      '@style' => $style->label(),
-      '@uri' => $variables['uri'],
+    \Drupal::logger('image')->warning('Image style (@style) missing for @image. Add the missing style under /admin/config/media/image-styles.', [
+      '@style' => $variables["style_name"],
+      '@image' => $variables['uri'],
     ]);
   }
+  else {
+    // Determine the dimensions of the styled image.
+    $dimensions = [
+      'width' => $variables['width'],
+      'height' => $variables['height'],
+    ];
+
+    $style->transformDimensions($dimensions, $variables['uri']);
+
+    $variables['image'] = [
+      '#theme' => 'image',
+      '#width' => $dimensions['width'],
+      '#height' => $dimensions['height'],
+      '#attributes' => $variables['attributes'],
+      '#style_name' => $variables['style_name'],
+    ];
+
+    // If the current image toolkit supports this file type, prepare the URI for
+    // the derivative image. If not, just use the original image resized to the
+    // dimensions specified by the style.
+    if (isset($variables['uri']) && $style->supportsUri($variables['uri'])) {
+      $variables['image']['#uri'] = $style->buildUrl($variables['uri']);
+    }
+    else {
+      $variables['image']['#uri'] = $variables['uri'];
+      // Don't render the image by default, but allow other preprocess functions
+      // to override that if they need to.
+      $variables['image']['#access'] = FALSE;
+
+      // Inform the site builders why their image didn't work.
+      \Drupal::logger('image')->warning('Could not apply @style image style to @uri because the style does not support it.', [
+        '@style' => $style->label(),
+        '@uri' => $variables['uri'],
+      ]);
+    }
 
-  if (\array_key_exists('alt', $variables)) {
-    $variables['image']['#alt'] = $variables['alt'];
-  }
-  if (\array_key_exists('title', $variables)) {
-    $variables['image']['#title'] = $variables['title'];
+    if (\array_key_exists('alt', $variables)) {
+      $variables['image']['#alt'] = $variables['alt'];
+    }
+    if (\array_key_exists('title', $variables)) {
+      $variables['image']['#title'] = $variables['title'];
+    }
   }
-
 }
 
 /**
diff --git a/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php b/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php
index ab2c11c2e5..faf82db5eb 100644
--- a/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php
+++ b/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php
@@ -237,7 +237,9 @@ public function viewElements(FieldItemListInterface $items, $langcode) {
     $base_cache_tags = [];
     if (!empty($image_style_setting)) {
       $image_style = $this->imageStyleStorage->load($image_style_setting);
-      $base_cache_tags = $image_style->getCacheTags();
+      if (!empty($image_style)) {
+        $base_cache_tags = $image_style->getCacheTags();
+      }
     }
 
     foreach ($files as $delta => $file) {
