aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/extra/m_mysql.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2024-08-04 11:29:49 +0100
committerGravatar Sadie Powell2024-08-04 11:29:49 +0100
commit6e2f3cef2ef0ac9fa99d844ab5216e1b10ef6b7d (patch)
treeeb72de537a350777e2de7c8e306c9a63403b2812 /src/modules/extra/m_mysql.cpp
parentFix bursting server metadata. (diff)
downloadinspircd++-6e2f3cef2ef0ac9fa99d844ab5216e1b10ef6b7d.tar.gz
inspircd++-6e2f3cef2ef0ac9fa99d844ab5216e1b10ef6b7d.tar.bz2
inspircd++-6e2f3cef2ef0ac9fa99d844ab5216e1b10ef6b7d.zip
Fix trying to fetch more MySQL rows than are available.
MySQL returns -1 on error in an unsigned field which was breaking this.
Diffstat (limited to 'src/modules/extra/m_mysql.cpp')
-rw-r--r--src/modules/extra/m_mysql.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp
index a3a930d98..17df7ca4a 100644
--- a/src/modules/extra/m_mysql.cpp
+++ b/src/modules/extra/m_mysql.cpp
@@ -170,7 +170,8 @@ public:
MySQLresult(MYSQL_RES* res, unsigned long affected_rows)
: err(SQL::SUCCESS)
{
- if (affected_rows >= 1)
+ // mysql returns -1 on error even though the return type is unsigned
+ if (affected_rows >= 1 && affected_rows != (unsigned long)-1)
{
rows = int(affected_rows);
fieldlists.resize(rows);