Skip to content

Commit

Permalink
fix crash
Browse files Browse the repository at this point in the history
  • Loading branch information
AGulev committed Jan 16, 2020
1 parent 6056ff8 commit 1a778d0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 24 deletions.
12 changes: 2 additions & 10 deletions extension-iap/src/iap_android.cpp
Expand Up @@ -277,11 +277,7 @@ static void HandleProductResult(const IAPCommand* cmd)
IAP_PushError(L, "failed to fetch product", REASON_UNSPECIFIED);
}

int ret = lua_pcall(L, 3, 0, 0);
if (ret != 0) {
dmLogError("Error running callback: %s", lua_tostring(L, -1));
lua_pop(L, 1);
}
dmScript::PCall(L, 3, 0);

dmScript::TeardownCallback(cmd->m_Callback);
dmScript::DestroyCallback(cmd->m_Callback);
Expand Down Expand Up @@ -335,11 +331,7 @@ static void HandlePurchaseResult(const IAPCommand* cmd)
IAP_PushError(L, "failed to buy product", REASON_UNSPECIFIED);
}

int ret = dmScript::PCall(L, 3, 0);
if (ret != 0) {
dmLogError("Error running callback: %s", lua_tostring(L, -1));
lua_pop(L, 1);
}
dmScript::PCall(L, 3, 0);

dmScript::TeardownCallback(cmd->m_Callback);

Expand Down
6 changes: 2 additions & 4 deletions extension-iap/src/iap_emscripten.cpp
Expand Up @@ -71,8 +71,7 @@ static void IAPList_Callback(void* luacallback, const char* result_json)
IAP_PushError(L, "Got empty list result.", REASON_UNSPECIFIED);
}

int ret = dmScript::PCall(L, 3, 0);
(void)ret;
dmScript::PCall(L, 3, 0);

dmScript::DestroyCallback(callback);
dmScript::TeardownCallback(callback);
Expand Down Expand Up @@ -144,8 +143,7 @@ static void IAPListener_Callback(void* luacallback, const char* result_json, int
}
}

int ret = dmScript::PCall(L, 3, 0);
(void)ret;
dmScript::PCall(L, 3, 0);

dmScript::TeardownCallback(callback);
}
Expand Down
12 changes: 2 additions & 10 deletions extension-iap/src/iap_ios.mm
Expand Up @@ -186,11 +186,7 @@ static void HandleProductResult(IAPCommand* cmd)
}
lua_pushnil(L);

int ret = dmScript::PCall(L, 3, 0);
if (ret != 0) {
dmLogError("%d: Error running callback: %s", __LINE__, lua_tostring(L, -1));
lua_pop(L, 1);
}
dmScript::PCall(L, 3, 0);

dmScript::TeardownCallback(cmd->m_Callback);
dmScript::DestroyCallback(cmd->m_Callback);
Expand Down Expand Up @@ -318,11 +314,7 @@ static void HandlePurchaseResult(IAPCommand* cmd)
lua_pushnil(L);
}

int ret = dmScript::PCall(L, 3, 0);
if (ret != 0) {
dmLogError("%d: Error running callback: %s", __LINE__, lua_tostring(L, -1));
lua_pop(L, 1);
}
dmScript::PCall(L, 3, 0);

dmScript::TeardownCallback(cmd->m_Callback);

Expand Down

0 comments on commit 1a778d0

Please sign in to comment.