aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2020-09-05 04:50:54 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2020-09-05 22:49:01 +0530
commit5896acc8eb74804222bc120043bf98c70257dcff (patch)
tree7016fbe6099a5bb2edab242cd27c81184717d173
parent63e2908d3623c1adc24f247eda4628df4f36cb39 (diff)
ClipboardService: use runCatching to replace exception handling
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/ClipboardService.kt7
1 files changed, 1 insertions, 6 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/ClipboardService.kt b/app/src/main/java/com/zeapo/pwdstore/ClipboardService.kt
index 7493a364..46c4ecd3 100644
--- a/app/src/main/java/com/zeapo/pwdstore/ClipboardService.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/ClipboardService.kt
@@ -45,12 +45,7 @@ class ClipboardService : Service() {
}
ACTION_START -> {
- val time = try {
- Integer.parseInt(settings.getString(PreferenceKeys.GENERAL_SHOW_TIME)
- ?: "45")
- } catch (e: NumberFormatException) {
- 45
- }
+ val time = settings.getString(PreferenceKeys.GENERAL_SHOW_TIME)?.toIntOrNull() ?: 45
if (time == 0) {
stopSelf()