mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-13 03:16:05 +08:00
Fix java.nio.BufferUnderflowException
This commit is contained in:
parent
f771077572
commit
1aafe78b77
@ -67,7 +67,7 @@ fun Input.readTLVMap(expectingEOF: Boolean = false, tagSize: Int = 1): MutableMa
|
|||||||
2 -> readUShort()
|
2 -> readUShort()
|
||||||
else -> error("Unsupported tag size: $tagSize")
|
else -> error("Unsupported tag size: $tagSize")
|
||||||
}
|
}
|
||||||
} catch (e: EOFException) {
|
} catch (e: Exception) { // java.nio.BufferUnderflowException is not a EOFException...
|
||||||
if (expectingEOF) {
|
if (expectingEOF) {
|
||||||
return map
|
return map
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ fun Input.readTLVMap(expectingEOF: Boolean = false, tagSize: Int = 1): MutableMa
|
|||||||
check(!map.containsKey(type.toUInt())) {
|
check(!map.containsKey(type.toUInt())) {
|
||||||
"Count not readTLVMap: duplicated key 0x${type.toUInt().toUHexString("")}. " +
|
"Count not readTLVMap: duplicated key 0x${type.toUInt().toUHexString("")}. " +
|
||||||
"map=$map" +
|
"map=$map" +
|
||||||
", duplicating value=${this.readUShortLVByteArray()}" +
|
", duplicating value=${this.readUShortLVByteArray().toUHexString()}" +
|
||||||
", remaining=" + if (expectingEOF) this.readBytes().toUHexString() else "[Not expecting EOF]"
|
", remaining=" + if (expectingEOF) this.readBytes().toUHexString() else "[Not expecting EOF]"
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user