From 6dd74791c7158f8ec2652119e43aa4b2f27ebd34 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Fri, 15 Nov 2024 09:46:17 +0100 Subject: [PATCH] fix NPE currentConversation!!.internalId followup to PR #4439 Exception java.lang.NullPointerException: at com.nextcloud.talk.chat.MessageInputFragment.handleMessageQueue (MessageInputFragment.kt:251) at com.nextcloud.talk.chat.MessageInputFragment.access$handleMessageQueue (MessageInputFragment.kt:82) at com.nextcloud.talk.chat.MessageInputFragment$initObservers$4$1.invokeSuspend (MessageInputFragment.kt:192) at com.nextcloud.talk.chat.MessageInputFragment$initObservers$4$1.invoke (Unknown Source:12) at com.nextcloud.talk.chat.MessageInputFragment$initObservers$4$1.invoke (Unknown Source:8) at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2.emit (Emitters.kt:219) at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt (Channels.kt:33) at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt (Channels.kt:1) at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend (Unknown Source:14) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:104) at android.os.Handler.handleCallback (Handler.java:938) at android.os.Handler.dispatchMessage (Handler.java:99) at android.os.Looper.loopOnce (Looper.java:241) at android.os.Looper.loop (Looper.java:342) at android.app.ActivityThread.main (ActivityThread.java:8128) at java.lang.reflect.Method.invoke at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:583) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1045) Signed-off-by: Marcel Hibbe --- .../main/java/com/nextcloud/talk/chat/MessageInputFragment.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/chat/MessageInputFragment.kt b/app/src/main/java/com/nextcloud/talk/chat/MessageInputFragment.kt index 2946927883..f803c4fc00 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/MessageInputFragment.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/MessageInputFragment.kt @@ -248,7 +248,7 @@ class MessageInputFragment : Fragment() { if (isOnline) { chatActivity.messageInputViewModel.switchToMessageQueue(false) chatActivity.messageInputViewModel.sendAndEmptyMessageQueue( - chatActivity.currentConversation!!.internalId, + conversationInternalId, chatActivity.conversationUser!!.getCredentials(), ApiUtils.getUrlForChat( chatActivity.chatApiVersion, @@ -796,7 +796,7 @@ class MessageInputFragment : Fragment() { private fun sendMessage(message: CharSequence, replyTo: Int?, sendWithoutNotification: Boolean) { chatActivity.messageInputViewModel.sendChatMessage( - chatActivity.currentConversation!!.internalId, + conversationInternalId, chatActivity.conversationUser!!.getCredentials(), ApiUtils.getUrlForChat( chatActivity.chatApiVersion,