diff options
author | Yorke Lee <yorkelee@google.com> | 2013-08-06 14:41:29 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2013-08-06 14:45:26 -0700 |
commit | 9f6c8729714763d3385ea849f395e6a65f3a08d2 (patch) | |
tree | d9221e8d69a9d10f17315eb58f1a785b18249aaa | |
parent | 31a760be9135b5ef05e504dbd1594e1617af0326 (diff) |
Fix crash in onPrepareOptionsMenu
Bug: 10206013
Change-Id: If12a25329701d04e3d40b0d6f18154336d8c90a3
-rw-r--r-- | src/com/android/dialer/calllog/CallLogActivity.java | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/com/android/dialer/calllog/CallLogActivity.java b/src/com/android/dialer/calllog/CallLogActivity.java index 2d976a929..39909a1f8 100644 --- a/src/com/android/dialer/calllog/CallLogActivity.java +++ b/src/com/android/dialer/calllog/CallLogActivity.java @@ -159,10 +159,9 @@ public class CallLogActivity extends Activity { public boolean onPrepareOptionsMenu(Menu menu) { final MenuItem itemDeleteAll = menu.findItem(R.id.delete_all); - final CallLogAdapter adapter = mAllCallsFragment.getAdapter(); - // Check if all the menu items are inflated correctly. As a shortcut, we assume all - // menu items are ready if the first item is non-null. - if (itemDeleteAll != null) { + // If onPrepareOptionsMenu is called before fragments loaded. Don't do anything. + if (mAllCallsFragment != null && itemDeleteAll != null) { + final CallLogAdapter adapter = mAllCallsFragment.getAdapter(); itemDeleteAll.setEnabled(adapter != null && !adapter.isEmpty()); } return true; |