onryldz / x-superobject

Delphi Cross Platform Rapid JSON
316 stars 118 forks source link

If ISuperObject is ISuperArray,ISuperObject.AsJSON raise AV 000000 #24

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
var
  jo: ISuperObject;
  ja: ISuperArray;
begin
  jo := SO('[1,2,3,4]');
  // why not  jo.Self is nil,if it is ok,you can provider it's DataType of ISuperObject
  if jo.Self.DataType = dtArray then    //jo.Self = nil
  begin
    ShowMessage(jo.AsArray.AsJSON);

    jo.AsArray.Add(5);
    jo.AsArray.Add('2323');
  end;
  //if ISuperObject is ISuperArray, jo.AsJSON raise av 0000000
  ShowMessage(jo.AsJSON); // raise here
end;

// thank you for your fix,you are a really master!!

Original issue reported on code.google.com by GreenSai...@gmail.com on 30 Mar 2014 at 4:40

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r51.

Original comment by onryld...@gmail.com on 30 Mar 2014 at 11:06

GoogleCodeExporter commented 9 years ago
var
  jo: ISuperObject;
  ja: ISuperArray;
begin
  jo := SO('[1,2,3,4]');
  if jo.DataType = dtArray then
  begin
    ShowMessage(jo.AsArray.AsJSON);
    jo.AsArray.Add(5);
    jo.AsArray.Add('2323');
  end;
  ShowMessage(jo.AsJSON); // Fix r52
end;

Original comment by onryld...@gmail.com on 30 Mar 2014 at 11:16