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()); }; }