Print database connection error that was previously unused

The string copied into `aError` was previously unused because the function immediately returns.

Now the error is logged to the console.
This commit is contained in:
Robert Müller 2023-01-28 14:11:57 +01:00
parent 854dc47cf7
commit 31bcc59a86

View file

@ -432,12 +432,12 @@ void CWorker::Print(IConsole *pConsole, CDbConnectionPool::Mode DatabaseMode)
/* static */
bool CDbConnectionPool::ExecSqlFunc(IDbConnection *pConnection, CSqlExecData *pData, Write w)
{
char aError[256] = "error message not initialized";
if(pConnection == nullptr)
{
str_format(aError, sizeof(aError), "No database given");
dbg_msg("sql", "No database given");
return false;
}
char aError[256] = "unknown error";
if(pConnection->Connect(aError, sizeof(aError)))
{
dbg_msg("sql", "failed connecting to db: %s", aError);