Catch EInvalidOp exceptions from calls to Trunc(), caused by unsigned Int64 values in string parameters of MakeInt().

This commit is contained in:
Ansgar Becker
2012-05-20 12:25:44 +00:00
parent aaf80e7d93
commit 548eb4003f

View File

@ -463,10 +463,15 @@ end;
@param string String-number
@return int64
}
function MakeInt( Str: String ) : Int64;
function MakeInt(Str: String): Int64;
begin
// Result has to be of integer type
Result := Trunc( MakeFloat( Str ) );
try
Result := Trunc(MakeFloat(Str));
except
on E:EInvalidOp do
Result := 0;
end;
end;