瀏覽代碼

Ensure screen is not null when setting Toolbar buttons

Guy Carmeli 8 年之前
父節點
當前提交
0514cc998f
共有 1 個檔案被更改,包括 6 行新增2 行删除
  1. 6
    2
      android/app/src/main/java/com/reactnativenavigation/views/RnnToolBar.java

+ 6
- 2
android/app/src/main/java/com/reactnativenavigation/views/RnnToolBar.java 查看文件

@@ -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