From a7208adaa0499da673dd6afc5531ce029bc01232 Mon Sep 17 00:00:00 2001 From: xx Date: Fri, 14 Jun 2024 19:01:15 +0800 Subject: [PATCH] =?UTF-8?q?SQLITE=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/util/sqlite3.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/util/sqlite3.cpp b/src/util/sqlite3.cpp index cc083dc..5d35651 100644 --- a/src/util/sqlite3.cpp +++ b/src/util/sqlite3.cpp @@ -46,7 +46,12 @@ bool ylib::sqlite3::open(const std::string& filepath, const std::string& usernam m_db = nullptr; if (sqlite3_open(codec::to_utf8(filepath).c_str(),(::sqlite3**)&m_db) != 0) { - this->m_lastErrorDesc = sqlite3_errmsg(DB_PTR); + if (m_db != nullptr) + { + this->m_lastErrorDesc = sqlite3_errmsg(DB_PTR); + close(); + } + return false; } return true;