From 38a05ab4de97ae3b89f91e2da996d2ee69d25473 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Tue, 19 Dec 2017 15:05:47 +0100 Subject: [PATCH] Prevent accessing non existing string list item in TMainForm.ListDatabasesGetText, to fix a sporadic crash after dropping a database. Closes #33 --- source/main.pas | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/main.pas b/source/main.pas index 0d993aea..72a039e7 100644 --- a/source/main.pas +++ b/source/main.pas @@ -9436,7 +9436,12 @@ begin Idx := Sender.GetNodeData(Node); Conn := ActiveConnection; - DBname := Conn.AllDatabases[Idx^]; + if Idx^ < Conn.AllDatabases.Count then begin + DBname := Conn.AllDatabases[Idx^]; + end else begin + // Probably a database were dropped shortly before. + DBname := ''; + end; if Conn.DbObjectsCached(DBname) then Objects := Conn.GetDBObjects(DBname) else