Skip to content
This repository was archived by the owner on Jul 28, 2022. It is now read-only.

Commit 43fde19

Browse files
committed
Safe showPendingMessage when there is no current activity
1 parent 8e787eb commit 43fde19

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

android/src/main/java/tech/bam/RNBatchPush/RNBatchModule.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,14 @@ public void push_getLastKnownPushToken(Promise promise) {
157157
// MESSAGING MODULE
158158

159159
private void showPendingMessage() {
160+
Activity activity = getCurrentActivity();
161+
if (activity == null) {
162+
return;
163+
}
164+
160165
BatchMessage message = Batch.Messaging.popPendingMessage();
161166
if (message != null) {
162-
Batch.Messaging.show(getCurrentActivity(), message);
167+
Batch.Messaging.show(activity, message);
163168
}
164169
}
165170

0 commit comments

Comments
 (0)