Skip to content

Commit

Permalink
chore: downgrade to kotlin 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
williamfzc authored Mar 17, 2021
1 parent 7fb8a7c commit 7ad9227
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {

// --------
// kotlin
kotlin_version = "1.4.20"
kotlin_version = "1.3.72"
// androidx
core_ktx_version = "1.2.0"
androidx_test_core_version = "1.2.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package com.williamfzc.randunit.operations

import java.lang.Exception

open class OperationManager {
private var operations = mutableSetOf<AbstractOperation>()

Expand All @@ -24,7 +26,11 @@ open class OperationManager {

fun poll(): AbstractOperation? {
synchronized(operations) {
return operations.randomOrNull()?.also { operations.remove(it) }
return try {
operations.random().also { operations.remove(it) }
} catch (e: Exception) {
null
}
}
}

Expand Down

0 comments on commit 7ad9227

Please sign in to comment.