tvplanit: Fix crash in print format component editor when the print format contains a GanttView.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8562 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-10-15 13:03:27 +00:00
parent bd7a544635
commit 10b89f8235
7 changed files with 26 additions and 12 deletions

View File

@@ -1116,7 +1116,7 @@ end;
function TVpGanttView.GetNumDays: Integer;
begin
Result := 0;
if (FRealStartDate <> NO_DATE) then
if ValidDate(FRealStartDate) and ValidDate(FRealEndDate) then
begin
Result := trunc(FRealEndDate) - trunc(FRealStartDate) + 1;
if Result < 0 then
@@ -1140,7 +1140,7 @@ var
y1, m1, d1: Word;
y2, m2, d2: Word;
begin
if (FRealStartDate <> NO_DATE) then
if ValidDate(FRealStartDate) and ValidDate(FRealEndDate) then
begin
DecodeDate(FRealStartDate, y1, m1, d1);
DecodeDate(FRealEndDate, y2, m2, d2);
@@ -1161,7 +1161,7 @@ var
dt1, dt2: TDate;
wn1, wn2: Integer;
begin
if (FRealStartDate <> NO_DATE) then
if ValidDate(FRealStartDate) and ValidDate(FRealEndDate) then
begin
d1 := GetVpDayType(FRealStartDate);
d2 := GetVpDayType(FRealEndDate);
@@ -1207,8 +1207,15 @@ end;
means the very first/last event. }
procedure TVpGanttView.GetRealEventDateRange(out AStartDate, AEndDate: TDate);
begin
if FStartDate > 0 then AStartDate := DatePart(FStartDate) else AStartDate := FFirstDate;
if FEndDate > 0 then AEndDate := DatePart(FEndDate) else AEndDate := FLastDate;
if ValidDate(FStartDate) then
AStartDate := DatePart(FStartDate)
else
AStartDate := FFirstDate;
if ValidDate(FEndDate) then
AEndDate := DatePart(FEndDate)
else
AEndDate := FLastDate;
end;
function TVpGanttView.GetRowAtCoord(Y: Integer): Integer;
@@ -1871,8 +1878,6 @@ begin
end;
procedure TVpGanttView.SetActiveEvent(AValue: TVpEvent);
var
i:Integer;
begin
if FActiveEvent <> AValue then
begin