Skip to content

Commit

Permalink
#10: bugfix NumberFormatException if there is a non numeric value (i.…
Browse files Browse the repository at this point in the history
…e. after language change)
  • Loading branch information
k3b committed May 17, 2018
1 parent 356eea7 commit 0da0cd9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/src/main/java/de/k3b/android/ToGoZip/SettingsImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ private static int getPrefValue(final SharedPreferences prefs,
try {
return Integer.parseInt(prefs.getString(key,
Integer.toString(notFoundValue)));
} catch (final ClassCastException ex) {
} catch (final Exception ex) {
// ClassCastException or NumberFormatException

Log.w(Global.LOG_CONTEXT, "getPrefValue-Integer(" + key + ","
+ notFoundValue + ") failed: " + ex.getMessage());
Expand All @@ -275,7 +276,8 @@ private static boolean getPrefValue(final SharedPreferences prefs,
final String key, final boolean notFoundValue) {
try {
return prefs.getBoolean(key, notFoundValue);
} catch (final ClassCastException ex) {
} catch (final Exception ex) {
// ClassCastException or FormatException
Log.w(Global.LOG_CONTEXT, "getPrefValue-Boolean(" + key + ","
+ notFoundValue + ") failed: " + ex.getMessage());
return notFoundValue;
Expand Down

0 comments on commit 0da0cd9

Please sign in to comment.