Does anybody know if I'm doing something wrong?
Does anybody know if I'm doing something wrong?
I call
if AJSONObject.GetValue('ContractState') <> nil then
begin
StringToAnsiCharArray(AJSONObject.GetValue('ContractState').Value,
FULInputs.ContractStateAbbrev, sizeOf(FULInputs.ContractStateAbbrev));
end
I get an access violation if ContractState is not in the JSON, but if it is the JSON, then it works fine..
The access violation is probably in the code in the begin..end, but I was thinking that the if statement should prevent it from executing those statements.. any ideas?
I call
if AJSONObject.GetValue('ContractState') <> nil then
begin
StringToAnsiCharArray(AJSONObject.GetValue('ContractState').Value,
FULInputs.ContractStateAbbrev, sizeOf(FULInputs.ContractStateAbbrev));
end
I get an access violation if ContractState is not in the JSON, but if it is the JSON, then it works fine..
The access violation is probably in the code in the begin..end, but I was thinking that the if statement should prevent it from executing those statements.. any ideas?
It is exceedingly cumbersome to debug services. Build your code so that it can operate either as a service or as a standard desktop app, headless
ReplyDeleteNever mind, it was a bug on my part. If the JSON key isn't in the list, I exited out of the function (in this case the entry point into the datasnap rest call) without setting the Result to the outbound JSON, and hence it was nil..
ReplyDeleteTools like madExcept can give you a stack trace. Just saying...
ReplyDelete