From f2f7418c8be0c6005e02b22e679fc3c715c03459 Mon Sep 17 00:00:00 2001 From: str4d <str4d@mail.i2p> Date: Wed, 16 Jul 2014 05:26:44 +0000 Subject: [PATCH] Ignore old Enum state --- .../java/net/i2p/android/router/service/RouterService.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/net/i2p/android/router/service/RouterService.java b/app/src/main/java/net/i2p/android/router/service/RouterService.java index c9734786a..edb09eb0d 100644 --- a/app/src/main/java/net/i2p/android/router/service/RouterService.java +++ b/app/src/main/java/net/i2p/android/router/service/RouterService.java @@ -766,7 +766,12 @@ public class RouterService extends Service { private int getSavedState() { SharedPreferences prefs = getSharedPreferences(SHARED_PREFS, 0); - return prefs.getInt(LAST_STATE, State.INIT); + try { + return prefs.getInt(LAST_STATE, State.INIT); + } catch (ClassCastException e) { + // Only a problem for first run after upgrade from old Enum state + return State.INIT; + } } private void setState(int s) { -- GitLab