aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/src/cgeo/geocaching/settings/SettingsActivity.java11
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) {