commit 0b626df1ebcef262702a46e8641f5ba9c8466718 parent 600dec7fc64a7d9a3d448d8ce759279c34aef1aa Author: rhunk <101876869+rhunk@users.noreply.github.com> Date: Fri, 1 Sep 2023 19:27:56 +0200 fix(media_downloader): unavailable proto toast Diffstat:
M | core/src/main/kotlin/me/rhunk/snapenhance/features/impl/downloader/MediaDownloader.kt | | | 11 | +++++++---- |
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/features/impl/downloader/MediaDownloader.kt b/core/src/main/kotlin/me/rhunk/snapenhance/features/impl/downloader/MediaDownloader.kt @@ -454,14 +454,17 @@ class MediaDownloader : MessagingRuleFeature("MediaDownloader", MessagingRuleTyp } val messageReader = ProtoReader(messageContent) - val urlProto: ByteArray = if (isArroyoMessage) { + val urlProto: ByteArray? = if (isArroyoMessage) { var finalProto: ByteArray? = null messageReader.eachBuffer(4, 5) { finalProto = getByteArray(1, 3) } - finalProto!! - } else { - deletedMediaReference!! + finalProto + } else deletedMediaReference + + if (urlProto == null) { + context.shortToast(translations["unsupported_content_type_toast"]) + return } runCatching {