Skip to content
This repository has been archived by the owner on Sep 4, 2019. It is now read-only.

Commit

Permalink
Merge pull request #7 from candyan/master
Browse files Browse the repository at this point in the history
fix Illegal callback invocation from native module. crash
  • Loading branch information
mdekrey committed Mar 10, 2019
2 parents 1cbb703 + 4775934 commit 9e5bfb3
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ public void onRewarded(RewardItem rewardItem) {
@Override
public void onRewardedVideoAdLoaded() {
sendEvent(EVENT_AD_LOADED, null);
mRequestAdPromise.resolve(null);
if (mRequestAdPromise != null) {
mRequestAdPromise.resolve(null);
mRequestAdPromise = null;
}
}

@Override
Expand Down Expand Up @@ -117,7 +120,11 @@ public void onRewardedVideoAdFailedToLoad(int errorCode) {
WritableMap error = Arguments.createMap();
event.putString("message", errorMessage);
sendEvent(EVENT_AD_FAILED_TO_LOAD, event);
mRequestAdPromise.reject(errorString, errorMessage);

if (mRequestAdPromise != null) {
mRequestAdPromise.reject(errorString, errorMessage);
mRequestAdPromise = null;
}
}

private void sendEvent(String eventName, @Nullable WritableMap params) {
Expand Down

0 comments on commit 9e5bfb3

Please sign in to comment.