joaorobertoct2 / x-superobject

Automatically exported from code.google.com/p/x-superobject
0 stars 0 forks source link

AsArray gives an AV #50

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
JSON:

{
  "test1": {
    "test2": {
      "test3": {
...

var
  JSONObject: ISuperObject;
  Object1, Object2: ISuperObject;
  Member: IMember;
begin
  JSONObject := TSuperObject.ParseFile(AFileName);

  Object1 := JSONObject['test1."test2"'].AsObject;
  Object2 := Object1['test3'].AsObject;
  for Member in Object2.AsArray do <= AsArray gives an AV
  ...

because here...

function TSuperObject.AsArray: ISuperArray;
begin
  if not Assigned(FCasted) or not (FCasted is TJSONArray) then
     Exit(Nil)
  else
     Result := TSuperArray.Create(IJSONArray(FCasted));
end;

FCasted is nil. Is this is bug or feature?

Original issue reported on code.google.com by lasse.ma...@gmail.com on 11 Oct 2014 at 1:02

GoogleCodeExporter commented 9 years ago
Damn, my bad. It's not an array. Forget this. :)

Original comment by lasse.ma...@gmail.com on 11 Oct 2014 at 6:12

GoogleCodeExporter commented 9 years ago

Original comment by onryld...@gmail.com on 11 Oct 2014 at 9:02