Browse Source

Initialize the result before copy the values to it.

Henrique Gottardi Werlang 1 year ago
parent
commit
ed4651fb1a
1 changed files with 1 additions and 0 deletions
  1. 1 0
      packages/rtl/src/classes.pas

+ 1 - 0
packages/rtl/src/classes.pas

@@ -6570,6 +6570,7 @@ Var
 begin
 begin
   // This must be improved, but needs some asm or TJSFunction.call() to implement answers in
   // This must be improved, but needs some asm or TJSFunction.call() to implement answers in
   // https://stackoverflow.com/questions/29676635/convert-uint8array-to-array-in-javascript
   // https://stackoverflow.com/questions/29676635/convert-uint8array-to-array-in-javascript
+  SetLength(Result, Mem.Length);
   for i:=0 to mem.length-1 do
   for i:=0 to mem.length-1 do
     Result[i]:=Mem[i];
     Result[i]:=Mem[i];
 end;
 end;