Browse Source

TSQLConnection.DoInternalDisconnect: safe with Assigned(FStatements) - like TDatabase.CloseDataSets etc.

(cherry picked from commit 8bd9651abd870288c4668e8349fdf229cc08f9f0)
Ondrej Pokorny 1 year ago
parent
commit
2dd77e5a26
1 changed files with 11 additions and 8 deletions
  1. 11 8
      packages/fcl-db/src/sqldb/sqldb.pp

+ 11 - 8
packages/fcl-db/src/sqldb/sqldb.pp

@@ -1473,14 +1473,17 @@ Var
   L : TList;
   L : TList;
 
 
 begin
 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;
 end;
 
 
 procedure TSQLConnection.StartTransaction;
 procedure TSQLConnection.StartTransaction;