From 3155daf47f35167974b7c594aefde1b330f50afc Mon Sep 17 00:00:00 2001 From: Chi Date: Sun, 19 Mar 2017 07:41:47 +0300 Subject: [PATCH] Issue #2859546 by cburschka: Missing image style in template causes a fatal error --- src/TwigExtension.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/TwigExtension.php b/src/TwigExtension.php index e636e13..979676f 100644 --- a/src/TwigExtension.php +++ b/src/TwigExtension.php @@ -382,8 +382,9 @@ class TwigExtension extends \Twig_Extension { * in an 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)); + } } /**