Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

AV when json string is invalid #64

Closed
HeZiHang opened this issue Jan 19, 2017 · 0 comments
Closed

AV when json string is invalid #64

HeZiHang opened this issue Jan 19, 2017 · 0 comments

Comments

@HeZiHang
Copy link

ObjectsMapper.pas

class procedure Mapper.LoadJSONObjectFieldsStringToObject(AJSONObjectString: string;
AObject: TObject);
var
lJSON: TJSONObject;
begin
lJSON := TJSONObject.ParseJSONValue(AJSONObjectString) as TJSONObject;
try
InternalJSONObjectFieldsToObject(ctx, lJSON, AObject);
finally
lJSON.Free;
end;
end;

change to:
class procedure Mapper.LoadJSONObjectFieldsStringToObject(AJSONObjectString: string;
AObject: TObject);
var
lJSON: TJSONObject;
begin
lJSON := TJSONObject.ParseJSONValue(AJSONObjectString) as TJSONObject;
if Assigned(IJSON) then
try
InternalJSONObjectFieldsToObject(ctx, lJSON, AObject);
finally
lJSON.Free;
end;
end;

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant