From 8fafe3f5464c943f742372034d44eb5f82998f2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Thu, 25 Jan 2024 12:30:46 +0100 Subject: [PATCH] fix: prevent null pointer exception --- src/Twig/AppRuntime.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Twig/AppRuntime.php b/src/Twig/AppRuntime.php index e53b648..86858e2 100644 --- a/src/Twig/AppRuntime.php +++ b/src/Twig/AppRuntime.php @@ -50,8 +50,12 @@ class AppRuntime implements RuntimeExtensionInterface return 'nationality' === $property ? $country->getNationality() : $country->getName(); } - public function bpnPickupLabel(int $id): string + public function bpnPickupLabel(?int $id): string { + if (null === $id) { + return 'keine Busbegleitung'; + } + $pickup = $this->pickups->get($id); if (null === $pickup) {