diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/LockFreeLinkedList.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/LockFreeLinkedList.kt index aa3d8d2e4..c8a4e98e3 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/LockFreeLinkedList.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/LockFreeLinkedList.kt @@ -197,9 +197,9 @@ open class LockFreeLinkedList { inline fun forEach(block: (E) -> Unit) { var node: Node = head while (true) { + if (node === tail) return node.letValueIfValid(block) node = node.nextNode - if (node === tail) return } }