Skip to content

Commit 9d4e482

Browse files
committed
fix: added null guard
1 parent 1c46d74 commit 9d4e482

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

tns-core-modules-widgets/android/widgets/src/main/java/org/nativescript/widgets/BottomNavigationBar.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -243,13 +243,15 @@ public void onSelectedPositionChange(int position, int prevPosition) {
243243
}
244244

245245
private void setImageHeights(){
246-
for (TabItemSpec tabItem : this.mTabItems) {
247-
if(tabItem.imageHeight == 0 && tabItem.iconId != 0) {
248-
Drawable drawable = getResources().getDrawable(tabItem.iconId);
249-
tabItem.imageHeight = drawable.getIntrinsicHeight();
250-
}
251-
if(tabItem.imageHeight > this.mMaxImageHeight) {
252-
this.mMaxImageHeight = tabItem.imageHeight;
246+
if (this.mTabItems != null) {
247+
for (TabItemSpec tabItem : this.mTabItems) {
248+
if(tabItem.imageHeight == 0 && tabItem.iconId != 0) {
249+
Drawable drawable = getResources().getDrawable(tabItem.iconId);
250+
tabItem.imageHeight = drawable.getIntrinsicHeight();
251+
}
252+
if(tabItem.imageHeight > this.mMaxImageHeight) {
253+
this.mMaxImageHeight = tabItem.imageHeight;
254+
}
253255
}
254256
}
255257
}

0 commit comments

Comments
 (0)