Fixed bug with non row returning queries crashing.

This commit is contained in:
Arthur Ice 2014-08-10 14:19:35 -07:00
parent e1e219ae97
commit 12ded4b506

View File

@ -119,7 +119,10 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo
// successful query. get results. // successful query. get results.
MYSQL_RES* res = mysql_store_result(&mysql); MYSQL_RES* res = mysql_store_result(&mysql);
MySQLRequestResult requestResult(res, (uint32)mysql_affected_rows(&mysql), (uint32)mysql_num_rows(res), (uint32)mysql_field_count(&mysql), (uint32)mysql_insert_id(&mysql)); uint32 rowCount = 0;
if (res != nullptr)
rowCount = (uint32)mysql_num_rows(res);
MySQLRequestResult requestResult(res, (uint32)mysql_affected_rows(&mysql), rowCount, (uint32)mysql_field_count(&mysql), (uint32)mysql_insert_id(&mysql));
#if DEBUG_MYSQL_QUERIES >= 1 #if DEBUG_MYSQL_QUERIES >= 1