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: NPE in MessageCompose.onCreateOptionsMenu() #1898

Closed
cketti opened this issue Dec 31, 2016 · 2 comments
Closed

Crash: NPE in MessageCompose.onCreateOptionsMenu() #1898

cketti opened this issue Dec 31, 2016 · 2 comments
Milestone

Comments

@cketti
Copy link
Member

cketti commented Dec 31, 2016

Via Play Developer Console
Version: 5.201

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.fsck.k9.Account.hasDraftsFolder()' on a null object reference
	at com.fsck.k9.activity.MessageCompose.onCreateOptionsMenu(MessageCompose.java:1030)
	at android.app.Activity.onCreatePanelMenu(Activity.java:3075)
	at com.android.internal.policy.impl.PhoneWindow.preparePanel(PhoneWindow.java:621)
	at com.android.internal.policy.impl.PhoneWindow.doInvalidatePanelMenu(PhoneWindow.java:998)
	at com.android.internal.policy.impl.PhoneWindow$1.run(PhoneWindow.java:323)
	at android.os.Handler.handleCallback(Handler.java:739)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:145)
	at android.app.ActivityThread.main(ActivityThread.java:6873)
	at java.lang.reflect.Method.invoke(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:372)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
@philipwhiuk
Copy link
Contributor

This is an odd one.

mAccount is null.

But if it is set null initially, we should have called finish() during onCreate(). One option is 'onAccountChosen' has provided a null account to switch to. We can just do a null check for that.

@cketti
Copy link
Member Author

cketti commented Jan 1, 2017

It looks like onCreateOptionsMenu() is called even though we call finish() in onCreate() when no accounts have been found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants