瀏覽代碼

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

(cherry picked from commit 8bd9651abd870288c4668e8349fdf229cc08f9f0)
Ondrej Pokorny 1 年之前
父節點
當前提交
2dd77e5a26
共有 1 個文件被更改,包括 11 次插入8 次删除
  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;
 
 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;