rtl: fix possible division by zero

git-svn-id: trunk@24472 -
This commit is contained in:
paul 2013-05-08 06:00:44 +00:00
parent 980bc634b4
commit 72fd58d62e

View File

@ -115,6 +115,9 @@ var
begin
typeInfo:=aligntoptr(typeInfo+2+PByte(typeInfo)[1]);
Count:=PArrayInfo(typeInfo)^.ElCount;
{ no elements to process => exit }
if Count = 0 then
Exit;
ElSize:=PArrayInfo(typeInfo)^.Size div Count;
Info:=PArrayInfo(typeInfo)^.ElInfo;
{ Process elements }
@ -262,6 +265,9 @@ begin
{$else}
Result:=PArrayInfo(Temp)^.Size;
Count:=PArrayInfo(Temp)^.ElCount;
{ no elements to process => exit }
if Count = 0 then
Exit;
Info:=PArrayInfo(Temp)^.ElInfo;
copiedsize:=Result div Count;
Offset:=0;