thunderbird / thunderbird-android

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

Crash: NPE in AccountSetupIncoming.getSelectedSecurity() #1877

Open cketti opened 7 years ago

cketti commented 7 years ago

Via Play Developer Console App version: 5.200

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.fsck.k9/com.fsck.k9.activity.setup.AccountSetupIncoming}: java.lang.NullPointerException: Attempt to read from field 'com.fsck.k9.mail.ConnectionSecurity com.fsck.k9.activity.setup.ConnectionSecurityHolder.connectionSecurity' on a null object reference
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
    at android.app.ActivityThread.-wrap11(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5417)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.NullPointerException: Attempt to read from field 'com.fsck.k9.mail.ConnectionSecurity com.fsck.k9.activity.setup.ConnectionSecurityHolder.connectionSecurity' on a null object reference
    at com.fsck.k9.activity.setup.AccountSetupIncoming.getSelectedSecurity(AccountSetupIncoming.java:645)
    at com.fsck.k9.activity.setup.AccountSetupIncoming.validateFields(AccountSetupIncoming.java:414)
    at com.fsck.k9.activity.setup.AccountSetupIncoming.onPostCreate(AccountSetupIncoming.java:378)
    at android.app.Instrumentation.callActivityOnPostCreate(Instrumentation.java:1188)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2398)
    ... 9 more
philipwhiuk commented 7 years ago

Somehow there's no selectedItem ( mSecurityTypeView.getSelectedItem() returns a null ConnectionSecurityHolder). Possibly the right approach is just to set a sane default.