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(){
for (TabItemSpec tabItem : this.mTabItems) {
if(tabItem.imageHeight == 0 && tabItem.iconId != 0) {
Drawable drawable = getResources().getDrawable(tabItem.iconId);
tabItem.imageHeight = drawable.getIntrinsicHeight();
}
if(tabItem.imageHeight > this.mMaxImageHeight) {
this.mMaxImageHeight = tabItem.imageHeight;
if (this.mTabItems != null) {
for (TabItemSpec tabItem : this.mTabItems) {
if(tabItem.imageHeight == 0 && tabItem.iconId != 0) {
Drawable drawable = getResources().getDrawable(tabItem.iconId);
tabItem.imageHeight = drawable.getIntrinsicHeight();
}
if(tabItem.imageHeight > this.mMaxImageHeight) {
this.mMaxImageHeight = tabItem.imageHeight;
}
}
}
}