Merge "Fix null pointer exception when updating action bar shadow." into oc-mr1-dev

This commit is contained in:
Doris Ling
2017-07-28 17:03:49 +00:00
committed by Android (Google) Code Review
2 changed files with 12 additions and 1 deletions

View File

@@ -121,7 +121,7 @@ public class ActionBarShadowController implements LifecycleObserver, OnStart, On
final boolean shouldShowShadow = view.canScrollVertically(-1);
if (mAnchorView != null) {
mAnchorView.setElevation(shouldShowShadow ? ELEVATION_HIGH : ELEVATION_LOW);
} else {
} else if (mActivity != null) { // activity can become null when running monkey
final ActionBar actionBar = mActivity.getActionBar();
if (actionBar != null) {
actionBar.setElevation(shouldShowShadow ? ELEVATION_HIGH : ELEVATION_LOW);