Commit 844a96d9 authored by Chen Bill's avatar Chen Bill Committed by GitHub

Improve error handling in DataManager::Error (#2872)

parent 3b885f2f
...@@ -165,8 +165,10 @@ void DataManager::ReadStringConfLine(const char* linebuf) { ...@@ -165,8 +165,10 @@ void DataManager::ReadStringConfLine(const char* linebuf) {
} }
} }
bool DataManager::Error(sqlite3* pDB, sqlite3_stmt* pStmt) { bool DataManager::Error(sqlite3* pDB, sqlite3_stmt* pStmt) {
std::snprintf(errmsg, sizeof errmsg, "%s", sqlite3_errmsg(pDB)); if (const char* msg = sqlite3_errmsg(pDB))
if(pStmt) std::snprintf(errmsg, sizeof errmsg, "%s", msg);
else
errmsg[0] = '\0';
sqlite3_finalize(pStmt); sqlite3_finalize(pStmt);
return false; return false;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment