diff --git a/mapcache/build.gradle b/mapcache/build.gradle index b00fc99a..e633ecc6 100644 --- a/mapcache/build.gradle +++ b/mapcache/build.gradle @@ -15,7 +15,7 @@ android { resValue "string", "applicationId", applicationId minSdkVersion 28 targetSdkVersion 31 - versionCode 52 + versionCode 53 versionName '2.1.7' multiDexEnabled true } diff --git a/mapcache/src/main/java/mil/nga/mapcache/GeoPackageMapFragment.java b/mapcache/src/main/java/mil/nga/mapcache/GeoPackageMapFragment.java index 3cfe86fa..cdb2aa28 100644 --- a/mapcache/src/main/java/mil/nga/mapcache/GeoPackageMapFragment.java +++ b/mapcache/src/main/java/mil/nga/mapcache/GeoPackageMapFragment.java @@ -2225,9 +2225,11 @@ private void setAppDarkMode() { boolean appDarkMode = settings.getBoolean(SETTINGS_APP_DARK_KEY, false); if (appDarkMode) { AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + if (map == null || getContext() == null) return; map.setMapStyle(MapStyleOptions.loadRawResourceStyle(getContext(), R.raw.dark_map)); } else { AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); + if (map == null || getContext() == null) return; map.setMapStyle(MapStyleOptions.loadRawResourceStyle(getContext(), R.raw.default_map)); } } diff --git a/mapcache/src/main/java/mil/nga/mapcache/preferences/BasemapSettingsIO.java b/mapcache/src/main/java/mil/nga/mapcache/preferences/BasemapSettingsIO.java index 75efbfdf..6de3d420 100644 --- a/mapcache/src/main/java/mil/nga/mapcache/preferences/BasemapSettingsIO.java +++ b/mapcache/src/main/java/mil/nga/mapcache/preferences/BasemapSettingsIO.java @@ -79,6 +79,7 @@ public void saveSettings(Activity activity, SharedPreferences prefs, BasemapSett if(settings.getSelectedBasemap().length > 0) { BasemapServerModel model = settings.getSelectedBasemap()[0]; String serverUrl = model.getServerUrl(); + if(serverUrl == null || serverUrl.isEmpty()) return; int mapType = Integer.parseInt(serverUrl); editor.putInt(BasemapSettingsIO.MAP_TYPE_KEY, mapType);