Browse Source

Ensure screen is not null when setting Toolbar buttons

Guy Carmeli 8 years ago
parent
commit
0514cc998f

+ 6
- 2
android/app/src/main/java/com/reactnativenavigation/views/RnnToolBar.java View File

@@ -100,11 +100,15 @@ public class RnnToolBar extends Toolbar {
100 100
     }
101 101
 
102 102
     public void handleOnCreateOptionsMenuAsync() {
103
-        setupToolbarButtonsAsync(null, mScreens.get(0));
103
+        if (mScreens != null) {
104
+            setupToolbarButtonsAsync(null, mScreens.get(0));
105
+        }
104 106
     }
105 107
 
106 108
     public void setupToolbarButtonsAsync(Screen newScreen) {
107
-        this.setupToolbarButtonsAsync(null, newScreen);
109
+        if (newScreen != null) {
110
+            this.setupToolbarButtonsAsync(null, newScreen);
111
+        }
108 112
     }
109 113
 
110 114