this line: if IndexFrom>IndexTo then exit;
should ensure the length is larger then 0
It also crashed if I change the line into : SetLength(hd,1000);
And I tried this:
var
cc:array of integer;
begin
...
SetLength(cc,100);
end;
it crashed too! And SetLength only crash in this procedure. In others it works fine. What stupid thing I did?