Browse Source

Issue #2859546 by cburschka: Missing image style in template causes a fatal error

8.x-1.x
Chi 8 years ago
parent
commit
3155daf47f
  1. 5
      src/TwigExtension.php

5
src/TwigExtension.php

@ -382,8 +382,9 @@ class TwigExtension extends \Twig_Extension {
* in an <img> tag. Requesting the URL will cause the image to be created.
*/
public function imageStyle($path, $style) {
$url = ImageStyle::load($style)->buildUrl($path);
return file_url_transform_relative($url);
if ($image_style = ImageStyle::load($style)) {
return file_url_transform_relative($image_style->buildUrl($path));
}
}
/**

Loading…
Cancel
Save