From 7c7ebd9b86c094103df43daba8bb1b8141c5a44d Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 17 Dec 2023 09:56:00 +0000 Subject: [PATCH] Issue 13731: Fix error concerning invalid user --- src/Model/User.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Model/User.php b/src/Model/User.php index a1d3bc65f8..28742e6395 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -567,10 +567,12 @@ class User */ public static function getLanguageCode(int $uid): string { - $owner = self::getOwnerDataById($uid); - $language = DI::l10n()->toISO6391($owner['language']); - if (in_array($language, array_keys(DI::l10n()->getLanguageCodes()))) { - return $language; + $owner = self::getOwnerDataById($uid); + if (!empty($owner['language'])) { + $language = DI::l10n()->toISO6391($owner['language']); + if (in_array($language, array_keys(DI::l10n()->getLanguageCodes()))) { + return $language; + } } return DI::l10n()->toISO6391(DI::config()->get('system', 'language')); } -- 2.39.5