Prevent NPE if no locale is configured

Fixes #833
This commit is contained in:
AsamK 2021-12-15 21:54:53 +01:00
parent d1ccd11fcb
commit 6bdfa11b66

View file

@ -76,6 +76,9 @@ public class Utils {
public static Locale getDefaultLocale() { public static Locale getDefaultLocale() {
final var locale = Locale.getDefault(); final var locale = Locale.getDefault();
if (locale == null) {
return null;
}
try { try {
Locale.LanguageRange.parse(locale.getLanguage() + "-" + locale.getCountry()); Locale.LanguageRange.parse(locale.getLanguage() + "-" + locale.getCountry());
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {