diff --git a/extension-iap/src/iap_android.cpp b/extension-iap/src/iap_android.cpp index d6f33f5..92adf32 100644 --- a/extension-iap/src/iap_android.cpp +++ b/extension-iap/src/iap_android.cpp @@ -244,6 +244,12 @@ JNIEXPORT void JNICALL Java_com_defold_iap_IapJNI_onPurchaseResult__ILjava_lang_ static void HandleProductResult(const IAPCommand* cmd) { + if (cmd->m_Callback == 0) + { + dmLogWarning("Received product list but no listener was set!"); + return; + } + lua_State* L = dmScript::GetCallbackLuaContext(cmd->m_Callback); int top = lua_gettop(L); @@ -289,6 +295,12 @@ static void HandleProductResult(const IAPCommand* cmd) static void HandlePurchaseResult(const IAPCommand* cmd) { + if (cmd->m_Callback == 0) + { + dmLogWarning("Received purchase result but no listener was set!"); + return; + } + lua_State* L = dmScript::GetCallbackLuaContext(cmd->m_Callback); int top = lua_gettop(L); diff --git a/extension-iap/src/java/com/defold/iap/IapGooglePlay.java b/extension-iap/src/java/com/defold/iap/IapGooglePlay.java index 8e60ce4..96aa612 100644 --- a/extension-iap/src/java/com/defold/iap/IapGooglePlay.java +++ b/extension-iap/src/java/com/defold/iap/IapGooglePlay.java @@ -67,7 +67,7 @@ public class IapGooglePlay implements Handler.Callback { private boolean autoFinishTransactions; private static interface ISkuRequestListener { - public void onProducts(int resultCode, JSONObject products); + public void onProducts(int resultCode, JSONObject products); } private static class SkuRequest { diff --git a/extension-iap/src/java/com/defold/iap/IapGooglePlayActivity.java b/extension-iap/src/java/com/defold/iap/IapGooglePlayActivity.java index ef12001..54198b0 100644 --- a/extension-iap/src/java/com/defold/iap/IapGooglePlayActivity.java +++ b/extension-iap/src/java/com/defold/iap/IapGooglePlayActivity.java @@ -69,8 +69,8 @@ public class IapGooglePlayActivity extends Activity { } private void buy(String product, String productType) { - // Flush any pending items, in order to be able to buy the same (new) product again - processPendingConsumables(); + // Flush any pending items, in order to be able to buy the same (new) product again + processPendingConsumables(); try { Bundle buyIntentBundle = service.getBuyIntent(3, getPackageName(), product, productType, "");