From 8b1d73356f2790fc6bc0c3ba0e4e5a422ac6b063 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 21 Oct 2024 16:18:12 +0200 Subject: [PATCH] Add condition to check if value passed to translatableStringHelper is not null --- .../Aggregator/PersonAggregators/GenderAggregator.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php index a2c656c5c..f4d22b8e6 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php @@ -59,7 +59,11 @@ final readonly class GenderAggregator implements AggregatorInterface return $this->translator->trans('Gender'); } - return (string) $this->translatableStringHelper->localize($this->repository->find((int) $value)?->getLabel()); + if (null === $gender = $this-repository->find((int) $value)) { + return ''; + } + + return (string) $this->translatableStringHelper->localize($gender->getLabel()); }; }