Browse Source

Add null check before setting font for menu item (#1036)

Guy Carmeli 7 years ago
parent
commit
9e9cab4150

+ 2
- 1
android/app/src/main/java/com/reactnativenavigation/views/TitleBarButton.java View File

@@ -3,6 +3,7 @@ package com.reactnativenavigation.views;
3 3
 import android.support.annotation.NonNull;
4 4
 import android.support.annotation.Nullable;
5 5
 import android.text.SpannableStringBuilder;
6
+import android.text.TextUtils;
6 7
 import android.view.Menu;
7 8
 import android.view.MenuItem;
8 9
 import android.view.View;
@@ -41,7 +42,7 @@ class TitleBarButton implements MenuItem.OnMenuItemClickListener {
41 42
     }
42 43
 
43 44
     private MenuItem createMenuItem(int index) {
44
-        if (!buttonParams.font.hasFont()) {
45
+        if (!buttonParams.font.hasFont() || TextUtils.isEmpty(buttonParams.label)) {
45 46
             return menu.add(Menu.NONE, Menu.NONE, index, buttonParams.label);
46 47
         }
47 48
         TypefaceSpan span = new TypefaceSpan(buttonParams.font.get());