From 9ee1dbc44bb9f913dac2ce28029a4f4ac8c1d771 Mon Sep 17 00:00:00 2001 From: Shin-NiL Date: Thu, 5 Mar 2020 19:06:41 -0300 Subject: [PATCH] Fixes #14 --- admob-plugin/src/GodotAdMob.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/admob-plugin/src/GodotAdMob.java b/admob-plugin/src/GodotAdMob.java index 16d73ca..65a258b 100644 --- a/admob-plugin/src/GodotAdMob.java +++ b/admob-plugin/src/GodotAdMob.java @@ -293,7 +293,15 @@ public void showBanner() { @Override public void run() { - if (adView.getVisibility() == View.VISIBLE) return; + if (adView == null) { + Log.w("w", "AdMob: showBanner - banner not loaded"); + return; + } + + if (adView.getVisibility() == View.VISIBLE) { + return; + } + adView.setVisibility(View.VISIBLE); adView.resume(); Log.d("godot", "AdMob: Show Banner"); @@ -444,7 +452,7 @@ public void showInterstitial() { @Override public void run() { - if (interstitialAd.isLoaded()) { + if (interstitialAd != null && interstitialAd.isLoaded()) { interstitialAd.show(); } else { Log.w("w", "AdMob: showInterstitial - interstitial not loaded");