Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix crash for unreadMarker #4440

Merged
merged 1 commit into from
Nov 13, 2024
Merged

Conversation

mahibi
Copy link
Collaborator

@mahibi mahibi commented Nov 13, 2024

see commit message

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔖 Capability is checked or not needed
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

When messages were sorted out in handleSystemMessages it can happen that the chatMessageList is empty. Because setUnreadMessageMarker accessed chatMessageList[0] this crashed.

This can happen e.g. when only a reaction to a chat message was made before opening the chat.

Exception java.lang.IndexOutOfBoundsException: Empty list doesn't contain element at index 0.
  at kotlin.collections.EmptyList.get (Collections.kt:37)
  at kotlin.collections.EmptyList.get (Collections.kt:25)
  at com.nextcloud.talk.chat.ChatActivity.setUnreadMessageMarker (ChatActivity.kt:2691)
  at com.nextcloud.talk.chat.ChatActivity.processMessagesFromTheFuture (ChatActivity.kt:2651)
  at com.nextcloud.talk.chat.ChatActivity.access$processMessagesFromTheFuture (ChatActivity.kt:209)
  at com.nextcloud.talk.chat.ChatActivity$initObservers$12$1.invokeSuspend (ChatActivity.kt:875)
  at com.nextcloud.talk.chat.ChatActivity$initObservers$12$1.invoke (Unknown Source:8)
  at com.nextcloud.talk.chat.ChatActivity$initObservers$12$1.invoke (Unknown Source:4)
  at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2.emit (Emitters.kt:219)
  at kotlinx.coroutines.flow.FlowKt__ErrorsKt$catchImpl$2.emit (Errors.kt:154)
  at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2.emit (Emitters.kt:220)
  at kotlinx.coroutines.flow.SharedFlowImpl.collect$suspendImpl (SharedFlow.kt:392)
  at kotlinx.coroutines.flow.SharedFlowImpl$collect$1.invokeSuspend (Unknown Source:15)
  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:942)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loopOnce (Looper.java:226)
  at android.os.Looper.loop (Looper.java:313)
  at android.app.ActivityThread.main (ActivityThread.java:8762)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:604)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1067)

Signed-off-by: Marcel Hibbe <[email protected]>
@mahibi mahibi added this to the 20.1.0 milestone Nov 13, 2024
@mahibi mahibi self-assigned this Nov 13, 2024
Copy link
Contributor

Codacy

Lint

TypemasterPR
Warnings94152
Errors13288

SpotBugs

CategoryBaseNew
Bad practice66
Correctness1616
Dodgy code7474
Internationalization33
Malicious code vulnerability33
Performance55
Security11
Total108108

Lint increased!

Copy link
Contributor

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/4440-talk.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud Talk app.

@sowjanyakch sowjanyakch merged commit 89f3d8a into master Nov 13, 2024
17 of 18 checks passed
@sowjanyakch sowjanyakch deleted the bugfix/noid/fixUnreadMarkerCrash branch November 13, 2024 14:05
@mahibi mahibi modified the milestones: 20.1.0, 20.0.4 Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants