Merge pull request #55 from defold/fix-json-migration-issue

Push nil as last argument if there is no error
This commit is contained in:
Björn Ritzl 2022-11-21 10:30:12 +01:00 committed by GitHub
commit f97a7ee6b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -308,6 +308,7 @@ static void HandleProductResult(const IAPCommand* cmd)
if (cmd->m_ResponseCode == BILLING_RESPONSE_RESULT_OK) {
const char* json = (const char*)cmd->m_Data;
dmScript::JsonToLua(L, json, strlen(json)); // throws lua error if it fails
lua_pushnil(L);
} else {
dmLogError("IAP error %d", cmd->m_ResponseCode);
lua_pushnil(L);
@ -343,6 +344,7 @@ static void HandlePurchaseResult(const IAPCommand* cmd)
if (cmd->m_Data != 0) {
const char* json = (const char*)cmd->m_Data;
dmScript::JsonToLua(L, json, strlen(json)); // throws lua error if it fails
lua_pushnil(L);
} else {
dmLogError("IAP error, purchase response was null");
lua_pushnil(L);

View File

@ -47,6 +47,7 @@ static void IAPList_Callback(void* luacallback, const char* result_json)
if(result_json != 0)
{
dmScript::JsonToLua(L, result_json, strlen(result_json)); // throws lua error if it fails
lua_pushnil(L);
}
else
{
@ -97,6 +98,7 @@ static void IAPListener_Callback(void* luacallback, const char* result_json, int
if (result_json) {
dmScript::JsonToLua(L, result_json, strlen(result_json)); // throws lua error if it fails
lua_pushnil(L);
} else {
lua_pushnil(L);
switch(error_code)