Skip to content

Commit 1286b3c

Browse files
pavel-alexeichikhyochan
authored andcommitted
Fix for double callback consume crash
1 parent c71a052 commit 1286b3c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

android/src/main/java/com/dooboolab/RNIap/RNIapModule.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,14 @@ private void ensureConnection (final Promise promise, final Runnable callback) {
122122

123123
@Override
124124
public void onBillingSetupFinished(@BillingClient.BillingResponse int responseCode) {
125-
if (responseCode == BillingClient.BillingResponse.OK ) {
126-
Log.d(TAG, "billing client ready");
127-
if (!bSetupCallbackConsumed) {
128-
bSetupCallbackConsumed = true;
125+
if (!bSetupCallbackConsumed) {
126+
bSetupCallbackConsumed = true;
127+
if (responseCode == BillingClient.BillingResponse.OK ) {
128+
Log.d(TAG, "billing client ready");
129129
callback.run();
130+
} else {
131+
rejectPromiseWithBillingError(promise, responseCode);
130132
}
131-
} else {
132-
rejectPromiseWithBillingError(promise, responseCode);
133133
}
134134
}
135135

0 commit comments

Comments
 (0)