From fd3b32482e86a4109f81c13f9fc35d5f3fa5e9ad Mon Sep 17 00:00:00 2001 From: Him188 Date: Fri, 5 Feb 2021 22:39:52 +0800 Subject: [PATCH] Add check for DeviceInfo.imsiMd5.size on init. #979 --- mirai-core-api/src/commonMain/kotlin/utils/DeviceInfo.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mirai-core-api/src/commonMain/kotlin/utils/DeviceInfo.kt b/mirai-core-api/src/commonMain/kotlin/utils/DeviceInfo.kt index 4314d292a..04782c3a4 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/DeviceInfo.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/DeviceInfo.kt @@ -43,6 +43,10 @@ public class DeviceInfo( public val androidId: ByteArray get() = display public val ipAddress: ByteArray get() = byteArrayOf(192.toByte(), 168.toByte(), 1, 123) + init { + require(imsiMd5.size == 16) { "Bad `imsiMd5.size`. Required 16, given ${imsiMd5.size}." } + } + @Transient @MiraiInternalApi public val guid: ByteArray = generateGuid(androidId, macAddress)