From 55e23ed461fd8f088af4146dd847b4f84c4346ed Mon Sep 17 00:00:00 2001 From: ede1998 Date: Fri, 10 Apr 2020 23:34:53 +0200 Subject: [PATCH] FIX: app does not crash with faulty settings, falls back to default instead --- app/build.gradle | 4 ++-- .../java/me/erikhennig/worktracks/model/PreferenceUtils.java | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 3e3ba28..d4aae2b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -14,8 +14,8 @@ android { applicationId "me.erikhennig.worktracks" minSdkVersion 26 targetSdkVersion 29 - versionCode 4 - versionName "1.2.1" + versionCode 5 + versionName "1.2.2" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" javaCompileOptions { diff --git a/app/src/main/java/me/erikhennig/worktracks/model/PreferenceUtils.java b/app/src/main/java/me/erikhennig/worktracks/model/PreferenceUtils.java index 95430ab..735e9aa 100644 --- a/app/src/main/java/me/erikhennig/worktracks/model/PreferenceUtils.java +++ b/app/src/main/java/me/erikhennig/worktracks/model/PreferenceUtils.java @@ -73,11 +73,10 @@ public static Duration getWeeklyWorkDuration(Context context) { private static Duration getWeeklyWorkDuration(SharedPreferences preferences) { String duration = preferences.getString(WEEKLY_WORK_DURATION, "37:00"); - try { return chronoFormatter.parseDuration(duration); } catch (DateTimeParseException e) { - return null; + return Duration.ofHours(37); } }