From 37744822d8975d8c5cc69714de377511e4735cdd Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sat, 12 Feb 2022 22:31:35 +0100 Subject: [PATCH] Handle not having any QU in LocalizationService (fixes #1783) --- changelog/67_UNRELEASED_xxxx-xx-xx.md | 2 +- services/LocalizationService.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/changelog/67_UNRELEASED_xxxx-xx-xx.md b/changelog/67_UNRELEASED_xxxx-xx-xx.md index e9a29586..e6d7183a 100644 --- a/changelog/67_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/67_UNRELEASED_xxxx-xx-xx.md @@ -48,7 +48,7 @@ ### General -- xxx +- Fixed an server error (on every page) when not having any quantity unit ### API diff --git a/services/LocalizationService.php b/services/LocalizationService.php index 76d9f1b3..c758303d 100644 --- a/services/LocalizationService.php +++ b/services/LocalizationService.php @@ -197,6 +197,8 @@ class LocalizationService $this->Translator = new Translator(); $this->Translator->loadTranslations($this->Po); + $this->PoQu = new Translations(); + $quantityUnits = null; try { @@ -209,7 +211,6 @@ class LocalizationService if ($quantityUnits !== null) { - $this->PoQu = new Translations(); $this->PoQu->setHeader(Translations::HEADER_PLURAL, $this->Po->getHeader(Translations::HEADER_PLURAL)); foreach ($quantityUnits as $quantityUnit)