Procházet zdrojové kódy

Fix npe in BottomTabswhen appStyle is undefined. Again.

Guy Carmeli před 8 roky
rodič
revize
a545549420

+ 10
- 5
android/app/src/main/java/com/reactnativenavigation/views/BottomTabs.java Zobrazit soubor

@@ -82,14 +82,19 @@ public class BottomTabs extends AHBottomNavigation {
82 82
     }
83 83
 
84 84
     private void setStyle() {
85
-        if (AppStyle.appStyle == null) {
86
-            return;
87
-        }
88
-        if (AppStyle.appStyle.bottomTabBadgeBackgroundColor.hasColor()) {
85
+        if (hasBadgeBackgroundColor()) {
89 86
             setNotificationBackgroundColor(AppStyle.appStyle.bottomTabBadgeBackgroundColor.getColor());
90 87
         }
91
-        if (AppStyle.appStyle.bottomTabBadgeTextColor.hasColor()) {
88
+        if (hasBadgeTextColor()) {
92 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
 }