From 14ff384039fc3376fa9b3bcdf6ecb3fec04f2480 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Tue, 1 Dec 2009 13:16:43 +0000 Subject: [PATCH] Avoid accessing grid data array elements over its bounds in Datagrid.OnBeforeCellPaint, while painting NULL cell background. Can happen as RootNodeCount is set asynchronously to scrolling. Fixes issue #1497 and friends. --- source/main.pas | 1 + 1 file changed, 1 insertion(+) diff --git a/source/main.pas b/source/main.pas index 3424641b..ed81e019 100644 --- a/source/main.pas +++ b/source/main.pas @@ -7411,6 +7411,7 @@ begin Exit; gr := GridResult(Sender); EnsureChunkLoaded(Sender, Node); + if Node.Index >= Cardinal(Length(gr.Rows)) then Exit; if (Node = Sender.FocusedNode) and (Column = Sender.FocusedColumn) then begin if not Sender.IsEditing then begin // Editors may not cover the whole cell rectangle, so any colored area looks broken then