diff --git a/src/Bridge/Twig/Extension/ThumbnailExtension.php b/src/Bridge/Twig/Extension/ThumbnailExtension.php index 13452c8..b9fc636 100644 --- a/src/Bridge/Twig/Extension/ThumbnailExtension.php +++ b/src/Bridge/Twig/Extension/ThumbnailExtension.php @@ -74,9 +74,10 @@ public function getFunctions(): array $request = $this->requestStack->getCurrentRequest(); if ($request === null) { - throw new \RuntimeException('Cannot use yassg_thumbnail without a request'); + $build = true; + } else { + $build = (bool) $request->attributes->get('yassg_build', false); } - $build = (bool) $request->attributes->get('yassg_build', false); $url = sprintf('%1$s/insecure/%2$s%3$s', $this->imgproxyUrl, $filter, $this->encode('local:///'.ltrim($relative, '/'))); if (! $build) { return $url;