Skip to content

Commit ffc6c64

Browse files
committed
remove NULL check for mapId
1 parent 0f47ae5 commit ffc6c64

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/mysql.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ using namespace std;
1111

1212
void CMysql::Connect()
1313
{
14+
this->g_iMapId = -1;
15+
1416
if (!g_pMysqlClient)
1517
return;
1618

@@ -236,7 +238,7 @@ void CMysql::Query_GetUser(IMySQLQuery *cb, CRankPlayer *pPlayer)
236238

237239
void CMysql::GetUserStats(CRankPlayer *pPlayer)
238240
{
239-
if(this->g_iMapId == NULL || this->g_iMapId < 1)
241+
if(this->g_iMapId < 1)
240242
{
241243
Fatal("Invalid Map ID on GetUserStats");
242244
return;
@@ -339,7 +341,7 @@ void CMysql::Query_GetUserStatsGlobal(IMySQLQuery *cb, CRankPlayer *pPlayer)
339341

340342
void CMysql::UpdateUser(CRankPlayer *pPlayer)
341343
{
342-
if(this->g_iMapId == NULL || this->g_iMapId < 1)
344+
if(this->g_iMapId < 1)
343345
{
344346
Fatal("Invalid Map ID on UpdateUser");
345347
return;
@@ -395,7 +397,7 @@ void CMysql::RemoveFromOtherMap(CRankPlayer *pPlayer)
395397
if (!g_pConnection)
396398
return;
397399

398-
if(this->g_iMapId == NULL || this->g_iMapId < 1)
400+
if(this->g_iMapId < 1)
399401
{
400402
Fatal("Invalid Map ID on RemoveFromOtherMap");
401403
return;
@@ -420,7 +422,7 @@ void CMysql::GetTopPlayers(bool global, std::function<void(std::map<std::string,
420422
if (!g_pConnection)
421423
return;
422424

423-
if((this->g_iMapId == NULL || this->g_iMapId < 1) && !global)
425+
if(this->g_iMapId < 1 && !global)
424426
{
425427
Fatal("Invalid Map ID on nt global GetTopPlayers");
426428
return;
@@ -460,7 +462,7 @@ void CMysql::GetRank(bool global, CRankPlayer *pPlayer, std::function<void(int)>
460462
if (!g_pConnection)
461463
return;
462464

463-
if(this->g_iMapId == NULL || this->g_iMapId < 1)
465+
if(this->g_iMapId < 1)
464466
{
465467
Fatal("Invalid Map ID on GetRank");
466468
return;

0 commit comments

Comments
 (0)