Skip to content

use currentUserFlow - #6741

Draft
mahibi wants to merge 1 commit into
masterfrom
fixCurrentUserNull
Draft

mahibi wants to merge 1 commit into
masterfrom
fixCurrentUserNull

Conversation

@mahibi

@mahibi mahibi commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

The lateinit currentUser is only set once ChatActivity's async
initData() call completes, which can race with onResume() calling
getRoom() and crash with UninitializedPropertyAccessException.

currentUserFlow is populated eagerly and independently of that init
sequencing, so use it instead - this removes the race rather than
just guarding around it.

avoids the crash

Exception in thread "main"
java.lang.RuntimeException: Unable to resume activity {com.nextcloud.talk2/com.nextcloud.talk.chat.ChatActivity}: kotlin.UninitializedPropertyAccessException: lateinit property currentUser has not been initialized
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:5695)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:5728)
at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:73)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:63)
at android.app.servertransaction.TransactionExecutor.executeLifecycleItem(TransactionExecutor.java:169)
at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:101)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2860)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loopOnce(Looper.java:283)
at android.os.Looper.loop(Looper.java:392)
at android.app.ActivityThread.main(ActivityThread.java:9248)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:611)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:944)
Caused by: kotlin.UninitializedPropertyAccessException: lateinit property currentUser has not been initialized
at com.nextcloud.talk.chat.viewmodels.ChatViewModel.getCurrentUser(ChatViewModel.kt:319)
at com.nextcloud.talk.chat.viewmodels.ChatViewModel.getRoom(ChatViewModel.kt:1740)
at com.nextcloud.talk.chat.ChatActivity.onResume(ChatActivity.kt:2043)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1803)
at android.app.Activity.performResume(Activity.java:9376)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:5680)
... 14 more

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

馃 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@mahibi mahibi added this to the 25.1.0 milestone Sep 21, 2026
@mahibi mahibi self-assigned this Sep 21, 2026
@mahibi mahibi added the 3. to review Waiting for reviews label Sep 21, 2026
@mahibi
mahibi marked this pull request as draft September 21, 2026 11:08
The lateinit currentUser is only set once ChatActivity's async
initData() call completes, which can race with onResume() calling
getRoom() and crash with UninitializedPropertyAccessException.

currentUserFlow is populated eagerly and independently of that init
sequencing, so use it instead - this removes the race rather than
just guarding around it.

Assisted-by: Claude Code:claude-sonnet-5

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
@mahibi mahibi changed the title guard getRoom with currentUser.isInitialized fix(chat): get currentUser from currentUserFlow in getRoom Sep 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

馃摫 QA build

Download app-qa-debug.apk
QR code Open the QR code for this download
Commit 2946d5f
Version 6741
Available until 7 days after this build

The QA build installs alongside a released Nextcloud app, so you can keep
using your existing install while testing.

Downloading the file requires a GitHub account, so open this link on the
device you want to test on, or transfer the APK to it.

@mahibi mahibi changed the title fix(chat): get currentUser from currentUserFlow in getRoom use currentUserFlow Sep 21, 2026
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 AI assisted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant