diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2013-08-25 15:49:36 +0200 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2013-08-25 15:49:36 +0200 |
| commit | 2f791d1a60f2ac41647ee75d7b0a3ef8365a7e31 (patch) | |
| tree | 5bcefbcb43c9a47557bb6b5e746dc087cc1326e9 /main/src | |
| parent | 162d9b5066f84b9dd5343f3c106b68a5f9ac02a6 (diff) | |
| download | cgeo-2f791d1a60f2ac41647ee75d7b0a3ef8365a7e31.zip cgeo-2f791d1a60f2ac41647ee75d7b0a3ef8365a7e31.tar.gz cgeo-2f791d1a60f2ac41647ee75d7b0a3ef8365a7e31.tar.bz2 | |
fix #3191: NumberFormatException in SettingsActivity
Diffstat (limited to 'main/src')
| -rw-r--r-- | main/src/cgeo/geocaching/settings/SettingsActivity.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/main/src/cgeo/geocaching/settings/SettingsActivity.java b/main/src/cgeo/geocaching/settings/SettingsActivity.java index ece2acb..4bcf279 100644 --- a/main/src/cgeo/geocaching/settings/SettingsActivity.java +++ b/main/src/cgeo/geocaching/settings/SettingsActivity.java @@ -40,7 +40,6 @@ import android.view.View; import android.widget.BaseAdapter; import android.widget.EditText; import android.widget.ListAdapter; -import android.widget.Toast; import java.io.File; import java.util.ArrayList; @@ -482,8 +481,14 @@ public class SettingsActivity extends PreferenceActivity { } } else if (isPreference(preference, R.string.pref_mapsource)) { // reset the cached map source - int mapSourceId = Integer.valueOf(stringValue); - MapSource mapSource = MapProviderFactory.getMapSource(mapSourceId); + MapSource mapSource; + try { + final int mapSourceId = Integer.valueOf(stringValue); + mapSource = MapProviderFactory.getMapSource(mapSourceId); + } catch (final NumberFormatException e) { + Log.e("SettingsActivity.onPreferenceChange: bad source id `" + stringValue + "'"); + mapSource = null; + } // If there is no corresponding map source (because some map sources were // removed from the device since) then use the first one available. if (mapSource == null) { |
