Преглед на файлове

* Fix for error-handling when a TSQLQuery is opened.

git-svn-id: trunk@2662 -
joost преди 19 години
родител
ревизия
f1fc3a316d
променени са 1 файла, в които са добавени 2 реда и са изтрити 1 реда
  1. 2 1
      fcl/db/sqldb/sqldb.pp

+ 2 - 1
fcl/db/sqldb/sqldb.pp

@@ -725,7 +725,8 @@ end;
 procedure TSQLQuery.InternalClose;
 begin
   if StatementType = stSelect then FreeFldBuffers;
-  if not IsPrepared then (database as TSQLconnection).UnPrepareStatement(FCursor);
+// Database and FCursor could be nil, for example if the database is not assigned, and .open is called
+  if (not IsPrepared) and (assigned(database)) and (assigned(FCursor)) then (database as TSQLconnection).UnPrepareStatement(FCursor);
   if DefaultFields then
     DestroyFields;
   FIsEOF := False;