Added protection in against a misnamed default language tag.

This commit is contained in:
tastybento 2020-03-17 23:13:38 -07:00
parent 5ca51f244e
commit cf986925a0

View File

@ -90,7 +90,8 @@ public class LocalesManager {
@Nullable
public String get(String reference) {
// Get the translation from the server's locale
if (languages.get(Locale.forLanguageTag(plugin.getSettings().getDefaultLanguage())).contains(reference)) {
if (languages.containsKey(Locale.forLanguageTag(plugin.getSettings().getDefaultLanguage()))
&& languages.get(Locale.forLanguageTag(plugin.getSettings().getDefaultLanguage())).contains(reference)) {
return languages.get(Locale.forLanguageTag(plugin.getSettings().getDefaultLanguage())).get(reference);
}
// Get the translation from the en-US locale