Skip to content

Commit 0df454b

Browse files
committed
handle exception from java.utils.Currency
1 parent 9e26590 commit 0df454b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

android/src/main/java/com/reactcommunity/rnlocalize/RNLocalizeModule.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,12 @@ private static String getCurrencyCode(Locale locale, String fallback) {
168168
return fallback;
169169
}
170170

171-
Currency currency = Currency.getInstance(locale);
172-
return currency == null ? fallback : currency.getCurrencyCode();
171+
try {
172+
Currency currency = Currency.getInstance(locale);
173+
return currency == null ? fallback : currency.getCurrencyCode();
174+
} catch (IllegalArgumentException e) {
175+
return fallback;
176+
}
173177
}
174178

175179
private static boolean getIsRTL(Locale locale) {

0 commit comments

Comments
 (0)