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,12 +72,17 @@ public class NavigationActivity extends AppCompatActivity implements DefaultHard
72 72
 
73 73
     private void createLayout() {
74 74
         layout = LayoutFactory.create(this, activityParams);
75
-        if (AppStyle.appStyle.screenBackgroundColor.hasColor()) {
75
+        if (hasBackgroundColor()) {
76 76
             layout.asView().setBackgroundColor(AppStyle.appStyle.screenBackgroundColor.getColor());
77 77
         }
78 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 86
     @Override
82 87
     protected void onStart() {
83 88
         super.onStart();