mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 00:09:15 +02:00
LazReport: check for null in formatfloat function, issue #34213
git-svn-id: trunk@58906 -
This commit is contained in:
parent
64b5cbf0b6
commit
a4bad60e2c
@ -12587,7 +12587,7 @@ begin
|
||||
1: dk := dkCount; //Add('COUNT'); {1}
|
||||
2: val := DayOf(frParser.Calc(p1)); //Add('DAYOF'); {2}
|
||||
3: val := FormatDateTime(frParser.Calc(p1), frParser.Calc(p2)); //Add('FORMATDATETIME'); {3}
|
||||
4: val := FormatFloat(frParser.Calc(p1), frParser.Calc(p2)); //Add('FORMATFLOAT'); {4}
|
||||
4: val := FormatFloat(frParser.Calc(p1), lrVarToFloatDef(frParser.Calc(p2))); //Add('FORMATFLOAT'); {4}
|
||||
5: val := FormatMaskText(frParser.Calc(p1) + ';0; ', frParser.Calc(p2)); //Add('FORMATTEXT'); {5}
|
||||
6:begin //Add('INPUT'); {6}
|
||||
s1 := InputBox('', frParser.Calc(p1), frParser.Calc(p2));
|
||||
|
@ -15,7 +15,7 @@ interface
|
||||
{$I LR_Vers.inc}
|
||||
|
||||
uses
|
||||
SysUtils, Classes, strutils, Graphics, Controls,
|
||||
SysUtils, Classes, strutils, Variants, Graphics, Controls,
|
||||
LR_DBRel, Forms, StdCtrls, ClipBrd, Menus, db,
|
||||
{$IFDEF WIN32}
|
||||
Windows,
|
||||
@ -70,6 +70,7 @@ function lrExpandVariables(const S:string):string;
|
||||
procedure lrNormalizeLocaleFloats(DisableLocale: boolean);
|
||||
function lrConfigFolderName(ACreatePath: boolean): string;
|
||||
function lrCanReadName(Stream: TStream): boolean;
|
||||
function lrVarToFloatDef(AValue:Variant; aDefault:Extended=0.0): Extended;
|
||||
|
||||
procedure CanvasTextRectJustify(const Canvas:TCanvas;
|
||||
const ARect: TRect; X1, X2, Y: integer; const Text: string;
|
||||
@ -955,6 +956,14 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function lrVarToFloatDef(AValue: Variant; aDefault: Extended): Extended;
|
||||
begin
|
||||
if not VarIsNumeric(AValue) then
|
||||
result := ADefault
|
||||
else
|
||||
result := AValue;
|
||||
end;
|
||||
|
||||
function UTF8Desc(S: string; var Desc: string): Integer;
|
||||
// create Desc as an array with Desc[i] is the size of the UTF-8 codepoint
|
||||
var
|
||||
|
Loading…
Reference in New Issue
Block a user