Crash fixes oh my

This commit is contained in:
KimLS 2014-08-28 03:47:28 -07:00
parent 467afc86af
commit ca84040a39
4 changed files with 10 additions and 2 deletions

View File

@ -161,7 +161,7 @@ uint32 Database::CheckLogin(const char* name, const char* password, int16* oStat
return 0;
}
if(results.RowCount() < 1)
if(results.RowCount() == 0)
return 0;
auto row = results.begin();

View File

@ -64,6 +64,5 @@ bool MySQLRequestRow::operator!=(const MySQLRequestRow& rhs)
char* MySQLRequestRow::operator[](int index)
{
return m_MySQLRow[index];
}

View File

@ -1632,6 +1632,13 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) {
int tempid = 0;
int counter = 0;
if(result && mysql_field_count(getMySQL()) <= SPELL_LOAD_FIELD_COUNT) {
_log(SPELLS__LOAD_ERR, "Fatal error loading spells: Spell field count < SPELL_LOAD_FIELD_COUNT(%u)", SPELL_LOAD_FIELD_COUNT);
mysql_free_result(result);
return;
}
while (row = mysql_fetch_row(result)) {
tempid = atoi(row[0]);
if(tempid >= max_spells) {

View File

@ -621,6 +621,8 @@ typedef enum {
// number. note that the id field is counted as 0, this way the numbers
// here match the numbers given to sep in the loading function net.cpp
//
#define SPELL_LOAD_FIELD_COUNT 231
struct SPDat_Spell_Struct
{
/* 000 */ int id; // not used