From 548eb4003fd8f7310a5d5734b379b83f7b75fd8e Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Sun, 20 May 2012 12:25:44 +0000 Subject: [PATCH] Catch EInvalidOp exceptions from calls to Trunc(), caused by unsigned Int64 values in string parameters of MakeInt(). --- source/helpers.pas | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/helpers.pas b/source/helpers.pas index b46b8fe7..55a1d7dc 100644 --- a/source/helpers.pas +++ b/source/helpers.pas @@ -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;