Skip to content
This repository was archived by the owner on Oct 7, 2024. It is now read-only.

Commit eaf01ce

Browse files
author
Langston Smith
authored
Added try/catch when TileLoadingInterceptor tries to get country code (#1183)
1 parent 680e619 commit eaf01ce

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/utils/TileLoadingInterceptor.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.util.ArrayList;
2424
import java.util.List;
2525
import java.util.Locale;
26+
import java.util.MissingResourceException;
2627

2728
import okhttp3.Interceptor;
2829
import okhttp3.Request;
@@ -101,7 +102,11 @@ private static String getMetadata() {
101102
metaData.addProperty("device", Build.MODEL);
102103
metaData.addProperty("version", Build.VERSION.RELEASE);
103104
metaData.addProperty("abi", Build.CPU_ABI);
104-
metaData.addProperty("country", Locale.getDefault().getISO3Country());
105+
try {
106+
metaData.addProperty("country", Locale.getDefault().getISO3Country());
107+
} catch (MissingResourceException exception) {
108+
metaData.addProperty("country", "none");
109+
}
105110
metaData.addProperty("ram", getRam());
106111
metaData.addProperty("screenSize", getWindowSize());
107112
metaData.addProperty("buildFlavor", BuildConfig.FLAVOR);

0 commit comments

Comments
 (0)