mirror of
https://github.com/defold/extension-iap
synced 2025-06-27 02:17:51 +02:00
Fixed crash if buying when no listener was set
This commit is contained in:
parent
c8d2d4e0d8
commit
8d9ea79d7d
@ -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);
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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, "");
|
||||
|
Loading…
x
Reference in New Issue
Block a user