From 09920d35eeaa7d7cdf1dbe1dd0f4d8ae143f5897 Mon Sep 17 00:00:00 2001 From: Karlatemp Date: Thu, 30 Dec 2021 22:51:49 +0800 Subject: [PATCH] Fix size-less image sending; fix #1769 --- mirai-core/src/commonMain/kotlin/message/imagesImpl.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mirai-core/src/commonMain/kotlin/message/imagesImpl.kt b/mirai-core/src/commonMain/kotlin/message/imagesImpl.kt index bfa2efadcf3..8ac56f25ac4 100644 --- a/mirai-core/src/commonMain/kotlin/message/imagesImpl.kt +++ b/mirai-core/src/commonMain/kotlin/message/imagesImpl.kt @@ -201,8 +201,8 @@ internal fun ImMsgBody.NotOnlineImage.toCustomFace(): ImMsgBody.CustomFace { flag = ByteArray(4), bigUrl = bigUrl, origUrl = origUrl, - width = picWidth, - height = picHeight, + width = picWidth.coerceAtLeast(1), + height = picHeight.coerceAtLeast(1), imageType = imgType, //_400Height = 235, //_400Url = "/gchatpic_new/000000000/1041235568-2195821338-01E9451B70EDEAE3B37C101F1EEBF5B5/400?term=2", @@ -257,8 +257,8 @@ internal fun OfflineGroupImage.toJceData(): ImMsgBody.CustomFace { picMd5 = this.md5, flag = ByteArray(4), size = size.toInt(), - width = width, - height = height, + width = width.coerceAtLeast(1), + height = height.coerceAtLeast(1), imageType = getIdByImageType(imageType), origin = if (imageType == ImageType.GIF) { 0