From 6e2f3cef2ef0ac9fa99d844ab5216e1b10ef6b7d Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 4 Aug 2024 11:29:49 +0100 Subject: Fix trying to fetch more MySQL rows than are available. MySQL returns -1 on error in an unsigned field which was breaking this. --- src/modules/extra/m_mysql.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/modules') 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); -- cgit v1.3.1-10-gc9f91