summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorroot <root@e03df62e-2008-0410-955e-edbf42e46eb7>2006-01-14 17:32:50 +0000
committerroot <root@e03df62e-2008-0410-955e-edbf42e46eb7>2006-01-14 17:32:50 +0000
commitedc83724ec0f22ccbb8a4d31238137096944d938 (patch)
tree76a3e6d0df7b167cf1449a034b6c0938fca8c930 /src
parent2e0a8b33aeba8d3b79c45f7c53696392499a1ee9 (diff)
Extra m_sql field checking
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2789 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-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;