Browse Source

Fix npe in BottomTabswhen appStyle is undefined. Again.

Guy Carmeli 8 years ago
parent
commit
a545549420

+ 10
- 5
android/app/src/main/java/com/reactnativenavigation/views/BottomTabs.java View File

82
     }
82
     }
83
 
83
 
84
     private void setStyle() {
84
     private void setStyle() {
85
-        if (AppStyle.appStyle == null) {
86
-            return;
87
-        }
88
-        if (AppStyle.appStyle.bottomTabBadgeBackgroundColor.hasColor()) {
85
+        if (hasBadgeBackgroundColor()) {
89
             setNotificationBackgroundColor(AppStyle.appStyle.bottomTabBadgeBackgroundColor.getColor());
86
             setNotificationBackgroundColor(AppStyle.appStyle.bottomTabBadgeBackgroundColor.getColor());
90
         }
87
         }
91
-        if (AppStyle.appStyle.bottomTabBadgeTextColor.hasColor()) {
88
+        if (hasBadgeTextColor()) {
92
             setNotificationTextColor(AppStyle.appStyle.bottomTabBadgeTextColor.getColor());
89
             setNotificationTextColor(AppStyle.appStyle.bottomTabBadgeTextColor.getColor());
93
         }
90
         }
94
     }
91
     }
92
+
93
+    private boolean hasBadgeTextColor() {
94
+        return AppStyle.appStyle.bottomTabBadgeTextColor != null && AppStyle.appStyle.bottomTabBadgeTextColor.hasColor();
95
+    }
96
+
97
+    private boolean hasBadgeBackgroundColor() {
98
+        return AppStyle.appStyle.bottomTabBadgeBackgroundColor != null && AppStyle.appStyle.bottomTabBadgeBackgroundColor.hasColor();
99
+    }
95
 }
100
 }