Add null checker to AppBarLayout

Fix: 191746368
Test: run atest CellBroadcastReceiverOemUnitTests on R
Change-Id: Id8130466fd282b68137ee8d848041f8607bf80a4
This commit is contained in:
Mill Chen
2021-07-01 11:29:26 +08:00
parent a391ee7e9b
commit 5b58e6d2ae

View File

@@ -58,7 +58,9 @@ public class CollapsingToolbarBaseActivity extends FragmentActivity implements
super.setContentView(R.layout.collapsing_toolbar_base_layout);
mCollapsingToolbarLayout = findViewById(R.id.collapsing_toolbar);
mAppBarLayout = findViewById(R.id.app_bar);
mAppBarLayout.addOnOffsetChangedListener(this);
if (mAppBarLayout != null) {
mAppBarLayout.addOnOffsetChangedListener(this);
}
if (savedInstanceState != null) {
mIsToolbarCollapsed = savedInstanceState.getBoolean(KEY_IS_TOOLBAR_COLLAPSED);
}