瀏覽代碼

Check for NPE when removing long press listener on buttons

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

+ 1
- 1
android/app/src/main/java/com/reactnativenavigation/views/TitleBarButton.java 查看文件

@@ -70,7 +70,7 @@ class TitleBarButton implements MenuItem.OnMenuItemClickListener {
70 70
             @Override
71 71
             public void run() {
72 72
                 ActionMenuView actionMenuView = ViewUtils.findChildByClass(parent, ActionMenuView.class);
73
-                if (actionMenuView != null) {
73
+                if (actionMenuView != null && actionMenuView.getChildAt(index) != null) {
74 74
                     actionMenuView.getChildAt(index).setOnLongClickListener(null);
75 75
                 }
76 76
             }