Browse Source

* Safety for empty asJSON. Should not happen, but better safe than sorry

git-svn-id: trunk@42784 -
michael 6 years ago
parent
commit
b38596b925
1 changed files with 2 additions and 1 deletions
  1. 2 1
      packages/fcl-web/src/jsonrpc/webjsonrpc.pp

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

@@ -275,7 +275,8 @@ begin
       AResponse.FreeContentStream:=True;
       AResponse.ContentStream:=TMemoryStream.Create;
       R:=Res.AsJSON;
-      AResponse.ContentStream.WriteBuffer(R[1],Length(R));
+      if Length(R)>0 then
+        AResponse.ContentStream.WriteBuffer(R[1],Length(R));
       AResponse.ContentLength:=AResponse.ContentStream.Size;
       R:=''; // Free up mem
       AResponse.ContentType:=GetResponseContentType;