thunderbird / thunderbird-android

Thunderbird for Android – Open Source Email App for Android (fka K-9 Mail)
https://thunderbird.net/
Apache License 2.0
10.05k stars 2.47k forks source link

Crash after log out of a duplicate account and then changing a folder #6533

Open mhf1998 opened 1 year ago

mhf1998 commented 1 year ago

Checklist

App version

6.500-SNAPSHOT

Where did you get the app from?

Other

Android version

8.1

Device model

emulator

Steps to reproduce

  1. Go to the drawer menu
  2. Go to Settings
  3. Go to "export settings"
  4. Select our account option
  5. Click export
  6. Back
  7. Click the "import settings"
  8. Select the file we exported from the previous step
  9. Click Import
  10. Enter the account password
  11. Click ok, and finally, it is successfully imported and goes back to settings
  12. Log out of the old account
  13. return to inbox
  14. select another folder from the drawer menu (for example, Sent)

Expected behavior

The folder opens correctly

Actual behavior

app crashed.

Logs

crash log:

2022-12-19 16:41:30.515 19401-19401/com.fsck.k9.debug E/AndroidRuntime: FATAL EXCEPTION: main Process: com.fsck.k9.debug, PID: 19401 java.lang.NullPointerException at com.fsck.k9.activity.MessageList.configureDrawer(MessageList.kt:1325) at com.fsck.k9.activity.MessageList.initializeFromLocalSearch(MessageList.kt:1304) at com.fsck.k9.activity.MessageList.performSearch(MessageList.kt:633) at com.fsck.k9.activity.MessageList.openFolder(MessageList.kt:589) at com.fsck.k9.ui.K9Drawer.handleItemClickListener(K9Drawer.kt:347) at com.fsck.k9.ui.K9Drawer.access$handleItemClickListener(K9Drawer.kt:67) at com.fsck.k9.ui.K9Drawer$1.invoke(K9Drawer.kt:111) at com.fsck.k9.ui.K9Drawer$1.invoke(K9Drawer.kt:110) at com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView$createContent$2.invoke(MaterialDrawerSliderView.kt:627) at com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView$createContent$2.invoke(MaterialDrawerSliderView.kt:603) at com.mikepenz.fastadapter.FastAdapter$viewClickListener$1.onClick(FastAdapter.kt:119) at com.mikepenz.fastadapter.utils.EventHookUtilKt.attachToView$lambda$0(EventHookUtil.kt:49) at com.mikepenz.fastadapter.utils.EventHookUtilKt.$r8$lambda$UfMYnnvsh8Q2M7QQxF9GnPD3K-Y(Unknown Source:0) at com.mikepenz.fastadapter.utils.EventHookUtilKt$$ExternalSyntheticLambda0.onClick(Unknown Source:4) at android.view.View.performClick(View.java:6294) at android.view.View$PerformClick.run(View.java:24770) at android.os.Handler.handleCallback(Handler.java:790) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

rezazarchi commented 1 year ago

I think it's because when we return to the inbox, in initializeFromLocalSearch in the MessageList, preferences.getAccount(accountUuids[0]) gives us null. But there is another problem. After I handled this null value, the crash resolved but items list in the drawer and messages didn't refresh properly. What should we do here? @cketti