8000 Fix application exit null-pointer exception (#582) · tmthecoder/flutter-webrtc@cbff1e7 · GitHub
[go: up one dir, main page]

Skip to content

Commit cbff1e7

Browse files
authored
Fix application exit null-pointer exception (flutter-webrtc#582)
When application exits, it throws an exception: Exception 'java.lang.NullPointerException' occurred in thread 'main' at com.cloudwebrtc.webrtc.FlutterWebRTCPlugin.onDetachedFromActivity(FlutterWebRTCPlugin.java:97) See also issue flutter-webrtc#578 Signed-off-by: Peter Antoniac <pan1nx+flutterwebrtc@gmail.com>
1 parent 1ed16f9 commit cbff1e7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

android/src/main/java/com/cloudwebrtc/webrtc/FlutterWebRTCPlugin.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ public void onDetachedFromActivity() {
9494
methodCallHandler.setActivity(null);
9595
if (this.observer != null) {
9696
this.lifecycle.removeObserver(this.observer);
97-
this.application.unregisterActivityLifecycleCallbacks(this.observer);
97+
if (this.application!=null) {
98+
this.application.unregisterActivityLifecycleCallbacks(this.observer);
99+
}
98100
}
99101
this.lifecycle = null;
100102
}

0 commit comments

Comments
 (0)
0