From da2b4e2321eaeb11b80b19baf970322ff1608fa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Mon, 11 Jan 2021 07:31:49 +0800 Subject: [PATCH] Fix crash --- .../src/main/java/tw/nekomimi/nekogram/utils/UpdateUtil.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/utils/UpdateUtil.kt b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/utils/UpdateUtil.kt index 4bb153161..533f4cc5b 100644 --- a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/utils/UpdateUtil.kt +++ b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/utils/UpdateUtil.kt @@ -28,12 +28,10 @@ object UpdateUtil { }) { response: TLObject?, error: TLRPC.TL_error? -> if (error == null) { val res = response as TLRPC.TL_contacts_resolvedPeer - if (res.chats.isEmpty()) { - return@sendRequest - } + val chat = res.chats.find { it.username == channelUsername } ?: return@sendRequest messagesCollector.putChats(res.chats, false) messagesStorage.putUsersAndChats(res.users, res.chats, false, true) - checkFollowChannel(ctx, currentAccount, res.chats.find { it.username == channelUsername }!!) + checkFollowChannel(ctx, currentAccount, chat) } } }