fix: added null guard

This commit is contained in:
Vasko
2020-03-06 14:35:57 +02:00
parent 1c46d748a0
commit 9d4e482b38

View File

@ -243,13 +243,15 @@ public class BottomNavigationBar extends LinearLayout {
} }
private void setImageHeights(){ private void setImageHeights(){
for (TabItemSpec tabItem : this.mTabItems) { if (this.mTabItems != null) {
if(tabItem.imageHeight == 0 && tabItem.iconId != 0) { for (TabItemSpec tabItem : this.mTabItems) {
Drawable drawable = getResources().getDrawable(tabItem.iconId); if(tabItem.imageHeight == 0 && tabItem.iconId != 0) {
tabItem.imageHeight = drawable.getIntrinsicHeight(); Drawable drawable = getResources().getDrawable(tabItem.iconId);
} tabItem.imageHeight = drawable.getIntrinsicHeight();
if(tabItem.imageHeight > this.mMaxImageHeight) { }
this.mMaxImageHeight = tabItem.imageHeight; if(tabItem.imageHeight > this.mMaxImageHeight) {
this.mMaxImageHeight = tabItem.imageHeight;
}
} }
} }
} }