From 8bd9651abd870288c4668e8349fdf229cc08f9f0 Mon Sep 17 00:00:00 2001 From: Ondrej Pokorny Date: Mon, 16 Oct 2023 11:43:23 +0200 Subject: [PATCH] TSQLConnection.DoInternalDisconnect: safe with Assigned(FStatements) - like TDatabase.CloseDataSets etc. --- packages/fcl-db/src/sqldb/sqldb.pp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/fcl-db/src/sqldb/sqldb.pp b/packages/fcl-db/src/sqldb/sqldb.pp index e562e2f654..c95f9c3809 100644 --- a/packages/fcl-db/src/sqldb/sqldb.pp +++ b/packages/fcl-db/src/sqldb/sqldb.pp @@ -1489,14 +1489,17 @@ Var L : TList; begin - L:=FStatements.LockList; - try - For I:=0 to L.Count-1 do - TCustomSQLStatement(L[i]).Unprepare; - L.Clear; - finally - FStatements.UnlockList; - end; + If Assigned(FStatements) then + begin + L:=FStatements.LockList; + try + For I:=0 to L.Count-1 do + TCustomSQLStatement(L[i]).Unprepare; + L.Clear; + finally + FStatements.UnlockList; + end; + end; end; procedure TSQLConnection.StartTransaction;