From 722490c406dd90e6decda6499cde69a302b1eedf Mon Sep 17 00:00:00 2001 From: Thomas Portelange Date: Wed, 26 Jun 2024 11:58:14 +0200 Subject: [PATCH] Finalize only if db is available Fixes https://github.com/silverstripe/silverstripe-sqlite3/issues/77 --- code/SQLite3Query.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/SQLite3Query.php b/code/SQLite3Query.php index 6b42f77..e6a097e 100644 --- a/code/SQLite3Query.php +++ b/code/SQLite3Query.php @@ -39,7 +39,7 @@ class SQLite3Query extends Query public function __destruct() { - if ($this->handle) { + if ($this->handle && $this->database->getSelectedDatabase()) { $this->handle->finalize(); } }