From 99a4580be01d4fa3c2dd3a1b29c2d1623734bfaa Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Tue, 26 Jan 2010 20:00:13 +0000 Subject: [PATCH] Work around a possible timing issue, when the db tree is painted with more nodes than the database has objects. Guess that occurs on a reconnection. Fixes issue #1621. --- source/main.pas | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/main.pas b/source/main.pas index 02b132b6..556cd50d 100644 --- a/source/main.pas +++ b/source/main.pas @@ -5927,6 +5927,10 @@ begin else ImageIndex := ICONINDEX_DB; 2: begin DBObjects := Connection.GetDBObjects(Databases[Node.Parent.Index]); + // Various bug reports refer to this location where we reference a db object which is outside the range + // of DBObjects. Probably a timing issue. Work around that by doing a safety check here. + if Node.Index >= DBObjects.Count then + Exit; case DBObjects[Node.Index].NodeType of lntTable: if Kind = ikSelected then