From 5896acc8eb74804222bc120043bf98c70257dcff Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sat, 5 Sep 2020 04:50:54 +0530 Subject: ClipboardService: use runCatching to replace exception handling Signed-off-by: Harsh Shandilya --- app/src/main/java/com/zeapo/pwdstore/ClipboardService.kt | 7 +------ 1 file changed, 1 insertion(+), 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() -- cgit v1.2.3