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? NPE for currentUser in ConversationList #4443

Closed
wants to merge 1 commit into from

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?)

On gplay console this was reported (not often).

It looks like currentUser could be null when getRoomsFlow is updated.

Maybe for some cases initialization was too late in onResume, so moved to onCreate. Not reproduced/tested though.

Exception java.lang.NullPointerException:
  at com.nextcloud.talk.conversationlist.ConversationsListActivity.addToConversationItems (ConversationsListActivity.kt:837)
  at com.nextcloud.talk.conversationlist.ConversationsListActivity.access$addToConversationItems (ConversationsListActivity.kt:149)
  at com.nextcloud.talk.conversationlist.ConversationsListActivity$initObservers$5$1.invokeSuspend (ConversationsListActivity.kt:379)
  at com.nextcloud.talk.conversationlist.ConversationsListActivity$initObservers$5$1.invoke (Unknown Source:8)
  at com.nextcloud.talk.conversationlist.ConversationsListActivity$initObservers$5$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 (Unknown Source)
  at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1.collect (SafeCollector.common.kt:112)
  at kotlinx.coroutines.flow.FlowKt__ErrorsKt.catchImpl (Errors.kt:152)
  at kotlinx.coroutines.flow.FlowKt.catchImpl (Unknown Source:1)
  at kotlinx.coroutines.flow.FlowKt__ErrorsKt$catch$$inlined$unsafeFlow$1.collect (SafeCollector.common.kt:112)
  at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1.collect (SafeCollector.common.kt:112)
  at kotlinx.coroutines.flow.FlowKt__CollectKt.collect (Collect.kt:26)
  at kotlinx.coroutines.flow.FlowKt.collect (Unknown Source:1)
  at com.nextcloud.talk.conversationlist.ConversationsListActivity$initObservers$5.invokeSuspend (ConversationsListActivity.kt:396)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
  at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith (DispatchedContinuation.kt:363)
  at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable (Cancellable.kt:26)
  at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable$default (Cancellable.kt:21)
  at kotlinx.coroutines.CoroutineStart.invoke (CoroutineStart.kt:88)
  at kotlinx.coroutines.AbstractCoroutine.start (AbstractCoroutine.kt:123)
  at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch (Builders.common.kt:52)
  at kotlinx.coroutines.BuildersKt.launch (Unknown Source:1)
  at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default (Builders.common.kt:43)
  at kotlinx.coroutines.BuildersKt.launch$default (Unknown Source:1)
  at com.nextcloud.talk.conversationlist.ConversationsListActivity.initObservers (ConversationsListActivity.kt:372)
  at com.nextcloud.talk.conversationlist.ConversationsListActivity.onCreate (ConversationsListActivity.kt:246)
  at android.app.Activity.performCreate (Activity.java:8595)
  at android.app.Activity.performCreate (Activity.java:8573)
  at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1475)
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3855)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:4013)
  at android.app.ActivityThread.handleRelaunchActivityInner (ActivityThread.java:6056)
  at android.app.ActivityThread.handleRelaunchActivity (ActivityThread.java:5952)
  at android.app.servertransaction.ActivityRelaunchItem.execute (ActivityRelaunchItem.java:76)
  at android.app.servertransaction.ActivityTransactionItem.execute (ActivityTransactionItem.java:45)
  at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:139)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:96)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2514)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loopOnce (Looper.java:232)
  at android.os.Looper.loop (Looper.java:334)
  at android.app.ActivityThread.main (ActivityThread.java:8293)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:578)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1053)

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
@mahibi mahibi added the 3. to review Waiting for reviews label Nov 13, 2024
@mahibi mahibi added this to the 20.1.0 milestone Nov 13, 2024
@mahibi mahibi self-assigned this Nov 13, 2024
Copy link
Contributor

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/4443-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.

Copy link
Contributor

Codacy

Lint

TypemasterPR
Warnings94152
Errors13288

SpotBugs

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

Lint increased!

@mahibi mahibi closed this Nov 13, 2024
@mahibi mahibi deleted the bugfix/noid/fixNpeCurrentUserInConvList branch November 13, 2024 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant