ClipboardService: use runCatching to replace exception handling

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2020-09-05 04:50:54 +05:30
parent 63e2908d36
commit 5896acc8eb
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80

View file

@ -45,12 +45,7 @@ class ClipboardService : Service() {
} }
ACTION_START -> { ACTION_START -> {
val time = try { val time = settings.getString(PreferenceKeys.GENERAL_SHOW_TIME)?.toIntOrNull() ?: 45
Integer.parseInt(settings.getString(PreferenceKeys.GENERAL_SHOW_TIME)
?: "45")
} catch (e: NumberFormatException) {
45
}
if (time == 0) { if (time == 0) {
stopSelf() stopSelf()