Prevent accessing non existing string list item in TMainForm.ListDatabasesGetText, to fix a sporadic crash after dropping a database. Closes #33

This commit is contained in:
Ansgar Becker
2017-12-19 15:05:47 +01:00
parent e8ed608a56
commit 38a05ab4de

View File

@@ -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