summaryrefslogtreecommitdiff
path: root/src/modules/extra
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/extra')
-rw-r--r--src/modules/extra/m_sql.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/modules/extra/m_sql.cpp b/src/modules/extra/m_sql.cpp
index 6b31ce871..dafd76118 100644
--- a/src/modules/extra/m_sql.cpp
+++ b/src/modules/extra/m_sql.cpp
@@ -115,15 +115,23 @@ class SQLConnection
if (row)
{
unsigned int field_count = 0;
+ MYSQL_FIELD *fields = mysql_fetch_fields(res);
if(mysql_field_count(&connection) == 0)
return thisrow;
- MYSQL_FIELD *fields = mysql_fetch_fields(res);
- while (field_count < mysql_field_count(&connection))
+ if (fields && mysql_field_count(&connection))
{
- thisrow[std::string(fields[field_count].name)] = std::string(row[field_count]);
- field_count++;
+ while (field_count < mysql_field_count(&connection))
+ {
+ if (fields[field_count] && fields[field_count].name && row[field_count])
+ {
+ std::string a = (fields[field_count].name ? fields[field_count].name : "");
+ std::string b = (row[field_count] ? row[field_count] : "");
+ thisrow[a] = b;
+ field_count++;
+ }
+ }
+ return thisrow;
}
- return thisrow;
}
}
return thisrow;