Browse Source

* Error object must be of type TJSOnErrorObject. Initialize Result to Nil in function TJSONRPCHandler.DoExecute (fixes access violation)

git-svn-id: trunk@15800 -
michael 15 years ago
parent
commit
2567d761a4
1 changed files with 2 additions and 1 deletions
  1. 2 1
      packages/fcl-web/src/jsonrpc/fpjsonrpc.pp

+ 2 - 1
packages/fcl-web/src/jsonrpc/fpjsonrpc.pp

@@ -356,7 +356,7 @@ implementation
 function CreateJSONErrorObject(Const AMessage : String; Const ACode : Integer) : TJSONObject;
 
 begin
-  Result:=TJSONObject.Create(['code',ACode,'message',AMessage])
+  Result:=TJSONErrorObject.Create(['code',ACode,'message',AMessage])
 end;
 
 function CreateJSON2ErrorResponse(Const AMessage : String; Const ACode : Integer; ID : TJSONData = Nil; idname : TJSONStringType = 'id' ) : TJSONObject;
@@ -583,6 +583,7 @@ end;
 
 function TJSONRPCHandler.DoExecute(const Params: TJSONData;AContext : TJSONRPCCallContext): TJSONData;
 begin
+  Result:=Nil;
   If Assigned(FOnExecute) then
     FOnExecute(Self,Params,Result);
 end;