3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-27 08:30:12 +01:00

LocaleUtils: don't NPE if no default locale mapping exists (#1239)

Dieser Commit ist enthalten in:
Camotoy 2020-09-01 18:29:53 -04:00 committet von GitHub
Ursprung b5f6ada4ae
Commit 7c4868cada
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -246,6 +246,11 @@ public class LocaleUtils {
Map<String, String> localeStrings = LocaleUtils.LOCALE_MAPPINGS.get(locale.toLowerCase()); Map<String, String> localeStrings = LocaleUtils.LOCALE_MAPPINGS.get(locale.toLowerCase());
if (localeStrings == null) if (localeStrings == null)
localeStrings = LocaleUtils.LOCALE_MAPPINGS.get(LanguageUtils.getDefaultLocale()); localeStrings = LocaleUtils.LOCALE_MAPPINGS.get(LanguageUtils.getDefaultLocale());
if (localeStrings == null) {
// Don't cause a NPE if the locale is STILL missing
GeyserConnector.getInstance().getLogger().debug("MISSING DEFAULT LOCALE: " + LanguageUtils.getDefaultLocale());
return messageText;
}
return localeStrings.getOrDefault(messageText, messageText); return localeStrings.getOrDefault(messageText, messageText);
} }