From 25171b272cd94a453912974a1b8b2ddc56e3bd8d Mon Sep 17 00:00:00 2001 From: Bob van de Vijver Date: Mon, 10 Oct 2022 10:55:54 +0200 Subject: [PATCH] Check for empty request before using it --- src/Widget/Injector/RequestZone.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Widget/Injector/RequestZone.php b/src/Widget/Injector/RequestZone.php index a7eda7ed6..805f5bc4e 100644 --- a/src/Widget/Injector/RequestZone.php +++ b/src/Widget/Injector/RequestZone.php @@ -67,6 +67,10 @@ public static function is(Request $request, string $value): bool */ public static function getFromRequest(?Request $request): string { + if (!$request) { + return static::NOWHERE; + } + return $request->attributes->get(static::KEY) ?: static::NOWHERE; }