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

Crash while configuring the drawer #8548

Open
2 tasks done
wmontwe opened this issue Nov 11, 2024 · 6 comments
Open
2 tasks done

Crash while configuring the drawer #8548

wmontwe opened this issue Nov 11, 2024 · 6 comments
Labels
type: bug Something is causing incorrect behavior or errors type: crash Issues that involve fixing a crash or ANR

Comments

@wmontwe
Copy link
Member

wmontwe commented Nov 11, 2024

Checklist

  • I have used the search function to see if someone else has already submitted the same bug report.
  • I will describe the problem with as much detail as possible.

App

Thunderbird for Android

App version

8+ versions

Where did you get the app from?

Google Play

Android version

Android 14 + 15

Device model

Google Pixel 6

Steps to reproduce

Not known yet, but observed that there is a condition where the account object is set to null within initializeFromLocalSearch

Expected behavior

Should not crash.

Actual behavior

Crash

Logs

Exception java.lang.NullPointerException:
  at com.fsck.k9.activity.MessageList.configureDrawer (MessageList.kt:1399)
  at com.fsck.k9.activity.MessageList.initializeFromLocalSearch (MessageList.kt:1373)
  at com.fsck.k9.activity.MessageList.performSearch (MessageList.kt:683)
  at com.fsck.k9.activity.MessageList.openFolder (MessageList.kt:634)
  at com.fsck.k9.activity.MessageList.initializeFolderDrawer$lambda$14 (MessageList.kt:597)
  at app.k9mail.feature.navigation.drawer.ui.DrawerViewKt$DrawerView$$inlined$observe$2$1.emit (UnidirectionalViewModel.kt:99)
  at kotlinx.coroutines.flow.SharedFlowImpl.collect$suspendImpl (SharedFlow.kt:397)
  at kotlinx.coroutines.flow.SharedFlowImpl$collect$1.invokeSuspend (SharedFlow.kt)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
  at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:101)
  at androidx.compose.ui.platform.AndroidUiDispatcher.performTrampolineDispatch (AndroidUiDispatcher.android.kt:81)
  at androidx.compose.ui.platform.AndroidUiDispatcher.access$setScheduledFrameDispatch$p (AndroidUiDispatcher.android.kt:41)
  at androidx.compose.ui.platform.AndroidUiDispatcher.access$performTrampolineDispatch (AndroidUiDispatcher.android.kt:41)
  at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.run (AndroidUiDispatcher.android.kt:57)
  at android.os.Handler.handleCallback (Handler.java:958)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loopOnce (Looper.java:230)
  at android.os.Looper.loop (Looper.java:319)
  at android.app.ActivityThread.main (ActivityThread.java:9063)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:588)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1103)

and

Exception java.lang.RuntimeException:
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3685)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3825)
  at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:101)
  at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2317)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loopOnce (Looper.java:201)
  at android.os.Looper.loop (Looper.java:288)
  at android.app.ActivityThread.main (ActivityThread.java:7972)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:586)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:942)
Caused by java.lang.NullPointerException:
  at com.fsck.k9.activity.MessageList.configureDrawer (MessageList.kt:1399)
  at com.fsck.k9.activity.MessageList.initializeFromLocalSearch (MessageList.kt:1373)
  at com.fsck.k9.activity.MessageList.findFragments (MessageList.kt:258)
  at com.fsck.k9.activity.MessageList.onCreate (MessageList.kt:186)
  at android.app.Activity.performCreate (Activity.java:8291)
  at android.app.Activity.performCreate (Activity.java:8270)
  at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1385)
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3666)
@wmontwe wmontwe added type: bug Something is causing incorrect behavior or errors unconfirmed Newly reported issues awaiting triage or confirmation labels Nov 11, 2024
@kewisch kewisch added type: crash Issues that involve fixing a crash or ANR and removed unconfirmed Newly reported issues awaiting triage or confirmation labels Nov 12, 2024
@kewisch
Copy link
Member

kewisch commented Nov 12, 2024

There are some play store crashes in configureDrawer, maybe related?

@wmontwe
Copy link
Member Author

wmontwe commented Nov 12, 2024

This is from the play store crash, but so far we're not able to reproduce it.

@marcRDZ
Copy link
Contributor

marcRDZ commented Dec 4, 2024

@kewisch @wmontwe

Hi guys,

I've been reviewing #8100 and trying to reproduce this bug with no luck but I've found something suspicious and may be it's related.

On this method mentioned in the crash the account field is set to null:

    private fun initializeFromLocalSearch(search: LocalSearch?) {
        this.search = search
        singleFolderMode = false

        if (!search!!.searchAllAccounts()) {
            val accountUuids = search.accountUuids
            if (accountUuids.size == 1) {
                account = accountManager.getAccount(accountUuids[0])
                val folderIds = search.folderIds
                singleFolderMode = folderIds.size == 1
            } else {
                account = null
            }
        }

        configureDrawer()
    }

And then configureDrawer() is accessing the value with not null assertion drawer.selectAccount(account!!.uuid)

The only thing I'm missing is how could I reach the case where accountUuids.size != 1 to check if I'm right.

@wmontwe
Copy link
Member Author

wmontwe commented Jan 10, 2025

Hi @marcRDZ,

thansk for looking into this. My theory is that there are more than one accounts found, but I wasn't able to reproduce the condition. It could be caused by how LocalSearch was configured and the searchAllAccounts() returns multiple accountUuids.

@marcRDZ
Copy link
Contributor

marcRDZ commented Jan 10, 2025

Yeah, that's the weird thing. I only could trigger the suspicious code when switching between folders and in that case search.accountUuids is always 1 so I didn't know how to reach a different situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something is causing incorrect behavior or errors type: crash Issues that involve fixing a crash or ANR
Projects
None yet
Development

No branches or pull requests

3 participants