Skip to content

Commit

Permalink
logic after null support recovering fixed
Browse files Browse the repository at this point in the history
* ref 1d4d52c
  • Loading branch information
rejchev committed Jul 20, 2023
1 parent caa852a commit 6a615ea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 10 additions & 2 deletions src/natives/json_a_natives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,11 @@ cell_t JsonArraySetJson(IPluginContext *pContext, const cell_t *params) {
if((json = nJansson::PCU::ReadJsonHandle(params[1], pType, &sec, IsArray)) == nullptr)
return 0;

return json->set(params[2], nJansson::PCU::ReadJsonHandle(params[3], pType, &sec));
nJansson::IJson* buffer = nullptr;
if(params[3] && (buffer = nJansson::PCU::ReadJsonHandle(params[3], pType, &sec)) == nullptr)
return 0;

return json->set(params[2], buffer);
}

cell_t JsonArraySetInt(IPluginContext *pContext, const cell_t *params) {
Expand Down Expand Up @@ -272,7 +276,11 @@ cell_t JsonArrayPushJson(IPluginContext *pContext, const cell_t *params) {
if((json = nJansson::PCU::ReadJsonHandle(params[1], pType, &sec, IsArray)) == nullptr)
return 0;

return json->push(nJansson::PCU::ReadJsonHandle(params[2], pType, &sec));
nJansson::IJson* buffer = nullptr;
if(params[2] && (buffer = nJansson::PCU::ReadJsonHandle(params[2], pType, &sec)) == nullptr)
return 0;

return json->push(buffer);
}

cell_t JsonArrayPushInt(IPluginContext *pContext, const cell_t *params) {
Expand Down
6 changes: 5 additions & 1 deletion src/natives/json_o_natives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,11 @@ cell_t JsonObjectSetJson(IPluginContext *pContext, const cell_t *params) {
char* key;
pContext->LocalToString(params[2], &key);

return json->set(key, nJansson::PCU::ReadJsonHandle(params[3], pType, &sec));
nJansson::IJson* buffer = nullptr;
if(params[3] && (buffer = nJansson::PCU::ReadJsonHandle(params[3], pType, &sec)) == nullptr)
return 0;

return json->set(key, buffer);
}

cell_t JsonObjectSetInt(IPluginContext *pContext, const cell_t *params) {
Expand Down

0 comments on commit 6a615ea

Please sign in to comment.