diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2014-09-01 20:48:59 +0200 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2014-09-01 20:48:59 +0200 |
| commit | 7833aae92088bc08948bcac4179d968c7f0f9a78 (patch) | |
| tree | 19fdea6572abd0cdbd9cbd27c338bc3b6178d480 | |
| parent | ace377c95a24105528aac637243106be38e7ab97 (diff) | |
| download | cgeo-7833aae92088bc08948bcac4179d968c7f0f9a78.zip cgeo-7833aae92088bc08948bcac4179d968c7f0f9a78.tar.gz cgeo-7833aae92088bc08948bcac4179d968c7f0f9a78.tar.bz2 | |
fix #4294: do not migrate nonexistent settings
| -rw-r--r-- | main/src/cgeo/geocaching/settings/Settings.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/settings/Settings.java b/main/src/cgeo/geocaching/settings/Settings.java index d45ded2..4f2721f 100644 --- a/main/src/cgeo/geocaching/settings/Settings.java +++ b/main/src/cgeo/geocaching/settings/Settings.java @@ -113,6 +113,12 @@ public class Settings { if (oldVersion < 1) { final String oldPreferencesName = "cgeo.pref"; final SharedPreferences old = CgeoApplication.getInstance().getSharedPreferences(oldPreferencesName, Context.MODE_PRIVATE); + + // No need to migrate if the shared preferences did not previously exist, the defaults will be fine. + if (old.getAll().isEmpty()) { + return; + } + final Editor e = sharedPrefs.edit(); e.putString(getKey(R.string.pref_temp_twitter_token_secret), old.getString(getKey(R.string.pref_temp_twitter_token_secret), null)); |
