]> git.mxchange.org Git - friendica.git/commitdiff
Issue 13731: Fix error concerning invalid user
authorMichael <heluecht@pirati.ca>
Sun, 17 Dec 2023 09:56:00 +0000 (09:56 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 17 Dec 2023 09:56:00 +0000 (09:56 +0000)
src/Model/User.php

index a1d3bc65f851faf8d0a8e2a1da878a46095dd05c..28742e639559a4e9cfd28e6fc8857f18cc10b76d 100644 (file)
@@ -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'));
        }