Skip to content

Commit 5c6d7a4

Browse files
almostintuitivekoenpunt
authored andcommitted
Fix: add checking for null to avoid exception when .setAdUnitId is set twice
1 parent 06e48fe commit 5c6d7a4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

android/src/main/java/com/sbugert/rnadmob/RNAdMobInterstitialAdModule.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ private void sendEvent(String eventName, @Nullable WritableMap params) {
106106

107107
@ReactMethod
108108
public void setAdUnitID(String adUnitID) {
109-
mInterstitialAd.setAdUnitId(adUnitID);
109+
if (mInterstitialAd.getAdUnitId() == null) {
110+
mInterstitialAd.setAdUnitId(adUnitID);
111+
}
110112
}
111113

112114
@ReactMethod

0 commit comments

Comments
 (0)