tvplanit: Fix Lazarus crashing if datastore is deleted from a form containing a MonthView.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5120 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-09-02 14:35:14 +00:00
parent 7e962a585f
commit e45bb283df

View File

@ -376,13 +376,15 @@ begin
end; end;
RenderCanvas.Font.Color := RealSelDayColor; RenderCanvas.Font.Color := RealSelDayColor;
RenderCanvas.Font.Style := FMonthView.DayNumberFont.Style + [fsBold]; RenderCanvas.Font.Style := FMonthView.DayNumberFont.Style + [fsBold];
if (FMonthView.EventDayStyle <> []) and (FMonthView.DataStore.Resource <> nil) and if (FMonthView.EventDayStyle <> []) and (FMonthView.Datastore <> nil) and
(FMonthView.DataStore.Resource <> nil) and
(FMonthView.DataStore.Resource.Schedule.EventCountByDay(ThisDate) > 0) (FMonthView.DataStore.Resource.Schedule.EventCountByDay(ThisDate) > 0)
then then
RenderCanvas.Font.Style := RenderCanvas.Font.Style + FMonthView.EventDayStyle; RenderCanvas.Font.Style := RenderCanvas.Font.Style + FMonthView.EventDayStyle;
end else begin end else begin
{ Set the font style for days which have events. } { Set the font style for days which have events. }
if (FMonthView.EventDayStyle <> []) and (FMonthView.DataStore.Resource <> nil) and if (FMonthView.EventDayStyle <> []) and (FMonthview.Datastore <> nil) and
(FMonthView.DataStore.Resource <> nil) and
(FMonthView.DataStore.Resource.Schedule.EventCountByDay(ThisDate) > 0) (FMonthView.DataStore.Resource.Schedule.EventCountByDay(ThisDate) > 0)
then then
RenderCanvas.Font.Style := RenderCanvas.Font.Style + FMonthView.EventDayStyle RenderCanvas.Font.Style := RenderCanvas.Font.Style + FMonthView.EventDayStyle
@ -484,13 +486,15 @@ begin
DrawFocusRect(TextRect); DrawFocusRect(TextRect);
RenderCanvas.Font.Color := RealSelDayColor; RenderCanvas.Font.Color := RealSelDayColor;
RenderCanvas.Font.Style := FMonthView.DayNumberFont.Style + [fsBold]; RenderCanvas.Font.Style := FMonthView.DayNumberFont.Style + [fsBold];
if (FMonthView.EventDayStyle <> []) and (FMonthView.DataStore.Resource <> nil) and if (FMonthView.EventDayStyle <> []) and (FMonthview.Datastore <> nil) and
(FMonthView.DataStore.Resource <> nil) and
(FMonthView.DataStore.Resource.Schedule.EventCountByDay(ThisDate) > 0) (FMonthView.DataStore.Resource.Schedule.EventCountByDay(ThisDate) > 0)
then then
RenderCanvas.Font.Style := RenderCanvas.Font.Style + FMonthView.EventDayStyle; RenderCanvas.Font.Style := RenderCanvas.Font.Style + FMonthView.EventDayStyle;
end else begin end else begin
{ Set the font style for days which have events. } { Set the font style for days which have events. }
if (FMonthView.EventDayStyle <> []) and (FMonthView.DataStore.Resource <> nil) and if (FMonthView.EventDayStyle <> []) and (FMonthView.Datastore <> nil) and
(FMonthView.DataStore.Resource <> nil) and
(FMonthView.DataStore.Resource.Schedule.EventCountByDay(ThisDate) > 0) (FMonthView.DataStore.Resource.Schedule.EventCountByDay(ThisDate) > 0)
then then
RenderCanvas.Font.Style := RenderCanvas.Font.Style + FMonthView.EventDayStyle RenderCanvas.Font.Style := RenderCanvas.Font.Style + FMonthView.EventDayStyle