tvplanit: Fix fulldemo with resource groups crashing due to nil resources.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5161 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-09-14 22:39:33 +00:00
parent 211225aed9
commit f436b26383
2 changed files with 13 additions and 5 deletions

View File

@@ -819,6 +819,7 @@ var
i: Integer; i: Integer;
event: TVpEvent; event: TVpEvent;
id: Integer; id: Integer;
res: TVpResource;
begin begin
Resource.Schedule.ClearGroupEvents; Resource.Schedule.ClearGroupEvents;
@@ -828,10 +829,16 @@ begin
end; end;
for i:=0 to Resource.Group.Count-1 do begin for i:=0 to Resource.Group.Count-1 do begin
id := Resource.Group[i].ResourceID; // current resource of group
if id = ResourceID then res := Resource.Group[i];
exit; if res <> nil then begin
LoadEventsOfResource(id); id := res.ResourceID;
// Ignore active resource in group
if id = ResourceID then
Continue;
// Load events of the current resource of the group
LoadEventsOfResource(id);
end;
end; end;
NotifyDependents; NotifyDependents;

View File

@@ -752,7 +752,8 @@ begin
if ACaption = '' then begin if ACaption = '' then begin
for i:=Low(AResIDs) + 1 to High(AResIDs) do begin for i:=Low(AResIDs) + 1 to High(AResIDs) do begin
res := GetResource(AResIDs[i]); res := GetResource(AResIDs[i]);
ACaption := ACaption + ', ' + res.Description; if res <> nil then
ACaption := ACaption + ', ' + res.Description;
end; end;
if ACaption <> '' then Delete(ACaption, 1, 2); if ACaption <> '' then Delete(ACaption, 1, 2);
end; end;