diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2010-03-13 22:37:30 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2010-03-13 22:37:30 +0000 |
commit | 1e917014ae92493e14e5ad10305139d71162d0e0 (patch) | |
tree | 3e2381dd1c11372dfabcd066e9b11d8e2b3e7587 /src | |
parent | 63732f37cba3d493954154c0f2440ddc88d7f207 (diff) |
Fix uninit pointer on MySQL initial connection
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12635 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/extra/m_mysql.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index b4d7cd7c6..d58b762ae 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -229,7 +229,7 @@ class SQLConnection : public SQLProvider // This constructor creates an SQLConnection object with the given credentials, but does not connect yet. SQLConnection(Module* p, ConfigTag* tag) : SQLProvider(p, "SQL/" + tag->getString("id")), - config(tag) + config(tag), connection(NULL) { } @@ -288,11 +288,9 @@ class SQLConnection : public SQLProvider bool CheckConnection() { - if (mysql_ping(connection) != 0) - { + if (!connection || mysql_ping(connection) != 0) return Connect(); - } - else return true; + return true; } std::string GetError() |