Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

AV in Contains function #145

Open
rgreat opened this issue Sep 17, 2021 · 0 comments
Open

AV in Contains function #145

rgreat opened this issue Sep 17, 2021 · 0 comments

Comments

@rgreat
Copy link

rgreat commented Sep 17, 2021

Fix:

function TBaseJSON<T, Typ>.GetData(Key: Typ): IJSONAncestor;
var
  P: IJsonPair;
begin
  if Self.InheritsFrom(TSuperObject) then begin
     if Assigned(FInterface) then begin // <--------- this one
       P := TJSONObject(FInterface).Get(PString(@Key)^);
       if Assigned(P) then begin
         Result := P.JsonValue
       end else begin
         Result := Nil;
       end;
     end else begin
       Result := Nil;
     end;
  end else begin
    if Self.InheritsFrom(TSuperArray) then begin
       // Maybe we need to check for Assigned(FInterface) here too?
       Result := TJSONArray(FInterface).Get(PInteger(@Key)^);
    end;
  end;
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant