summaryrefslogtreecommitdiffstats
path: root/src/sql
diff options
context:
space:
mode:
authorBill King <bill.king@nokia.com>2009-05-05 22:50:36 (GMT)
committerBill King <bill.king@nokia.com>2009-05-05 22:51:50 (GMT)
commita1d2c3c589a03cc427dcc22d109003576add9500 (patch)
tree576d0be06628d8b65d661577c159246f0386f6fe /src/sql
parent8ad9a7f781f1f092a2120773dccce4e8f50e675a (diff)
downloadQt-a1d2c3c589a03cc427dcc22d109003576add9500.zip
Qt-a1d2c3c589a03cc427dcc22d109003576add9500.tar.gz
Qt-a1d2c3c589a03cc427dcc22d109003576add9500.tar.bz2
Fixes crash when mysql_init() returns 0
Task-number: 250632
Diffstat (limited to 'src/sql')
-rw-r--r--src/sql/drivers/mysql/qsql_mysql.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp
index a84e840..1f54db7 100644
--- a/src/sql/drivers/mysql/qsql_mysql.cpp
+++ b/src/sql/drivers/mysql/qsql_mysql.cpp
@@ -224,7 +224,7 @@ static QTextCodec* codec(MYSQL* mysql)
static QSqlError qMakeError(const QString& err, QSqlError::ErrorType type,
const QMYSQLDriverPrivate* p)
{
- const char *cerr = mysql_error(p->mysql);
+ const char *cerr = p->mysql ? mysql_error(p->mysql) : 0;
return QSqlError(QLatin1String("QMYSQL: ") + err,
p->tc ? toUnicode(p->tc, cerr) : QString::fromLatin1(cerr),
type, mysql_errno(p->mysql));