From f25070ba4f73a589310a8a6793c555d2cd7378cc Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Wed, 14 Oct 2020 19:11:04 +0000 Subject: [PATCH] fpexif: Fix potential divide-by-zero error in TExposureTimeTag.GetAsString (https://forum.lazarus.freepascal.org/index.php/topic,44015.msg379681.html#msg379681). git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7779 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/fpexif/fpeexifdata.pas | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/fpexif/fpeexifdata.pas b/components/fpexif/fpeexifdata.pas index d62e23531..523a29b4e 100644 --- a/components/fpexif/fpeexifdata.pas +++ b/components/fpexif/fpeexifdata.pas @@ -1510,10 +1510,11 @@ var p: Integer; begin floatVal := GetAsFloat; + if IsNaN(floatVal) or (floatVal = 0) then + Result := '' + else if FFormatStr = '' then begin - if IsNaN(floatVal) then - Result := '' - else if floatVal >= 10 then + if floatVal >= 10 then Result := Format('%.0fs', [floatVal]) else if floatVal >= 1 then Result := Format('%.1fs', [floatVal])