소스 검색

Add null check to ViewVisibilityChecker

relates to #1555
Guy Carmeli 8 년 전
부모
커밋
60608b08ae
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5
    1
      android/app/src/main/java/com/reactnativenavigation/utils/ViewVisibilityChecker.java

+ 5
- 1
android/app/src/main/java/com/reactnativenavigation/utils/ViewVisibilityChecker.java 파일 보기

@@ -1,12 +1,16 @@
1 1
 package com.reactnativenavigation.utils;
2 2
 
3
+import android.support.annotation.Nullable;
3 4
 import android.view.View;
4 5
 
5 6
 import com.reactnativenavigation.views.ContentView;
6 7
 
7 8
 public class ViewVisibilityChecker {
8 9
 
9
-    public static boolean check(View view) {
10
+    public static boolean check(@Nullable View view) {
11
+        if (view == null) {
12
+            return false;
13
+        }
10 14
         final int top = getTopRelativeToContentView(view);
11 15
         final int scrollYInScreen = getScrollYInScreen(view);
12 16
         return top + view.getHeight() > scrollYInScreen;