Skip to content

Commit 91213c7

Browse files
committed
ionic-team#8182 Add missing null checks in BridgeActivity
1 parent 5767c45 commit 91213c7

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

android/capacitor/src/main/java/com/getcapacitor/BridgeActivity.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ public Bridge getBridge() {
6666
@Override
6767
public void onSaveInstanceState(Bundle outState) {
6868
super.onSaveInstanceState(outState);
69-
bridge.saveInstanceState(outState);
69+
if (bridge != null) {
70+
bridge.saveInstanceState(outState);
71+
}
7072
}
7173

7274
@Override
@@ -82,8 +84,10 @@ public void onStart() {
8284
@Override
8385
public void onRestart() {
8486
super.onRestart();
85-
this.bridge.onRestart();
86-
Logger.debug("App restarted");
87+
if (this.bridge != null) {
88+
this.bridge.onRestart();
89+
Logger.debug("App restarted");
90+
}
8791
}
8892

8993
@Override
@@ -131,7 +135,9 @@ public void onDestroy() {
131135
@Override
132136
public void onDetachedFromWindow() {
133137
super.onDetachedFromWindow();
134-
this.bridge.onDetachedFromWindow();
138+
if (this.bridge != null) {
139+
this.bridge.onDetachedFromWindow();
140+
}
135141
}
136142

137143
/**

0 commit comments

Comments
 (0)