ClipboardService: use runCatching to replace exception handling
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
63e2908d36
commit
5896acc8eb
1 changed files with 1 additions and 6 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue