Skip to content

Commit

Permalink
Fix NPE related to changed initialization order in Android 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
cketti committed Nov 22, 2012
1 parent f0118ec commit b96e7bb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/com/fsck/k9/fragment/MessageViewFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,10 @@ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
}

private void configureMenu(Menu menu) {
// first run displayMessage() gets called before onCreateOptionMenu()
if (menu == null) {
// In Android versions prior to 4.2 onCreateOptionsMenu() (which calls us) is called before
// onActivityCreated() when mAccount isn't initialized yet. In that case we do nothing and
// wait for displayMessage() to call us again.
if (menu == null || mAccount == null) {
return;
}

Expand Down

0 comments on commit b96e7bb

Please sign in to comment.