]> nmode's Git Repositories - signal-cli/commitdiff
Prevent NPE if no locale is configured
authorAsamK <asamk@gmx.de>
Wed, 15 Dec 2021 20:54:53 +0000 (21:54 +0100)
committerAsamK <asamk@gmx.de>
Wed, 15 Dec 2021 20:54:53 +0000 (21:54 +0100)
Fixes #833

lib/src/main/java/org/asamk/signal/manager/util/Utils.java

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