Commit 22096a9f authored by Him188's avatar Him188

Fix bugs

parent 25b162a0
......@@ -37,7 +37,7 @@ class ContactList<C : Contact>(@MiraiInternalAPI val delegate: LockFreeLinkedLis
operator fun <C : Contact> LockFreeLinkedList<C>.get(id: Long): C {
forEach { if (it.id == id) return it }
throw NoSuchElementException("No such contact with id $id")
throw NoSuchElementException("No such contact: $id")
}
fun <C : Contact> LockFreeLinkedList<C>.getOrNull(id: Long): C? {
......
......@@ -114,6 +114,8 @@ fun Input.readTLVMap(expectingEOF: Boolean = true, tagSize: Int, suppressDuplica
duplicating value=${this.readUShortLVByteArray().toUHexString()}
""".trimIndent()
)
} else {
this.discardExact(this.readShort().toInt() and 0xffff)
}
} else {
try {
......
......@@ -23,7 +23,11 @@ actual class PlatformSocket : Closeable {
actual val isOpen: Boolean
get() = socket.isConnected
override fun close() = socket.close()
override fun close() {
if (::socket.isInitialized) {
socket.close()
}
}
@PublishedApi
internal lateinit var writeChannel: BufferedOutputStream
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment