Browse Source

Fix npe when appStyle is undefined (#494)

fixes #493
Guy Carmeli 8 years ago
parent
commit
bb3a74c60f

+ 6
- 1
android/app/src/main/java/com/reactnativenavigation/controllers/NavigationActivity.java View File

72
 
72
 
73
     private void createLayout() {
73
     private void createLayout() {
74
         layout = LayoutFactory.create(this, activityParams);
74
         layout = LayoutFactory.create(this, activityParams);
75
-        if (AppStyle.appStyle.screenBackgroundColor.hasColor()) {
75
+        if (hasBackgroundColor()) {
76
             layout.asView().setBackgroundColor(AppStyle.appStyle.screenBackgroundColor.getColor());
76
             layout.asView().setBackgroundColor(AppStyle.appStyle.screenBackgroundColor.getColor());
77
         }
77
         }
78
         setContentView(layout.asView());
78
         setContentView(layout.asView());
79
     }
79
     }
80
 
80
 
81
+    private boolean hasBackgroundColor() {
82
+        return AppStyle.appStyle.screenBackgroundColor != null &&
83
+               AppStyle.appStyle.screenBackgroundColor.hasColor();
84
+    }
85
+
81
     @Override
86
     @Override
82
     protected void onStart() {
87
     protected void onStart() {
83
         super.onStart();
88
         super.onStart();