Finalize only if db is available

Fixes https://github.com/silverstripe/silverstripe-sqlite3/issues/77
This commit is contained in:
Thomas Portelange 2024-06-26 11:58:14 +02:00 committed by GitHub
parent 1e8d7357be
commit 722490c406
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -39,7 +39,7 @@ class SQLite3Query extends Query
public function __destruct()
{
if ($this->handle) {
if ($this->handle && $this->database->getSelectedDatabase()) {
$this->handle->finalize();
}
}