mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
LocaleUtils: don't NPE if no default locale mapping exists (#1239)
This commit is contained in:
parent
b5f6ada4ae
commit
7c4868cada
1 changed files with 5 additions and 0 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue