소스 검색

android: fix NPE when handling onHostPause

If the Activity is put into the background before the ReactContext is created we
get an NPE here. While the window might be short, it's thechnically possible to
hit this, as our Crashlytics reports show.
j8
Saúl Ibarra Corretgé 6 년 전
부모
커밋
944e8f8353
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1
    1
      android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivityDelegate.java

+ 1
- 1
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivityDelegate.java 파일 보기

122
             // https://github.com/facebook/react-native/blob/df4e67fe75d781d1eb264128cadf079989542755/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java#L512
122
             // https://github.com/facebook/react-native/blob/df4e67fe75d781d1eb264128cadf079989542755/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java#L512
123
             // Why this happens is a mystery wrapped in an enigma.
123
             // Why this happens is a mystery wrapped in an enigma.
124
             ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
124
             ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
125
-            if (activity == reactContext.getCurrentActivity()) {
125
+            if (reactContext != null && activity == reactContext.getCurrentActivity()) {
126
                 reactInstanceManager.onHostPause(activity);
126
                 reactInstanceManager.onHostPause(activity);
127
             }
127
             }
128
         }
128
         }

Loading…
취소
저장