diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/tryNTimes.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/tryNTimes.kt index 57f418797..c6b6884d0 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/tryNTimes.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/tryNTimes.kt @@ -24,8 +24,7 @@ inline fun 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 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 tryNTimesOrException(repeat: Int, block: (Int) -> R): Throwable? } catch (e: Throwable) { if (lastException == null) { lastException = e - } - lastException!!.addSuppressed(e) + } else lastException!!.addSuppressed(e) } }