mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-08 09:10:11 +08:00
Fix tryNTimes
This commit is contained in:
parent
bcaafbbe76
commit
32abb01861
@ -24,8 +24,7 @@ inline fun <R> tryNTimes(repeat: Int, block: (Int) -> R): R {
|
||||
} catch (e: Throwable) {
|
||||
if (lastException == null) {
|
||||
lastException = e
|
||||
}
|
||||
lastException!!.addSuppressed(e)
|
||||
} else lastException!!.addSuppressed(e)
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,8 +42,7 @@ inline fun <R> tryNTimesOrNull(repeat: Int, block: (Int) -> R): R? {
|
||||
} catch (e: Throwable) {
|
||||
if (lastException == null) {
|
||||
lastException = e
|
||||
}
|
||||
lastException!!.addSuppressed(e)
|
||||
} else lastException!!.addSuppressed(e)
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,8 +61,7 @@ inline fun <R> tryNTimesOrException(repeat: Int, block: (Int) -> R): Throwable?
|
||||
} catch (e: Throwable) {
|
||||
if (lastException == null) {
|
||||
lastException = e
|
||||
}
|
||||
lastException!!.addSuppressed(e)
|
||||
} else lastException!!.addSuppressed(e)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user