summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/extra/m_mysql.cpp8
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()