summaryrefslogtreecommitdiff
path: root/src/char_sql
diff options
context:
space:
mode:
authorParadox924X <Paradox924X@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-12-03 07:51:55 +0000
committerParadox924X <Paradox924X@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-12-03 07:51:55 +0000
commit450c0004c32acb37247a1cc4dd046703cf65e5f9 (patch)
treeabb274d752d8d991eae31dcfbc1a206bb0e74a14 /src/char_sql
parent9585903c287e30279867a9458394dd530f1c2bba (diff)
downloadhercules-450c0004c32acb37247a1cc4dd046703cf65e5f9.tar.gz
hercules-450c0004c32acb37247a1cc4dd046703cf65e5f9.tar.bz2
hercules-450c0004c32acb37247a1cc4dd046703cf65e5f9.tar.xz
hercules-450c0004c32acb37247a1cc4dd046703cf65e5f9.zip
Prevented online user count from going negative. (bugreport:3913)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14186 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char_sql')
-rw-r--r--src/char_sql/char.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index ee1e08bdb..9fc4aea99 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -212,7 +212,8 @@ void set_char_charselect(int account_id)
character = (struct online_char_data*)idb_ensure(online_char_db, account_id, create_online_char_data);
if( character->server > -1 )
- server[character->server].users--;
+ if( server[character->server].users > 0 ) // Prevent this value from going negative.
+ server[character->server].users--;
character->char_id = -1;
character->server = -1;
@@ -300,7 +301,8 @@ void set_char_offline(int char_id, int account_id)
if ((character = (struct online_char_data*)idb_get(online_char_db, account_id)) != NULL)
{ //We don't free yet to avoid aCalloc/aFree spamming during char change. [Skotlex]
if( character->server > -1 )
- server[character->server].users--;
+ if( server[character->server].users > 0 ) // Prevent this value from going negative.
+ server[character->server].users--;
if(character->waiting_disconnect != -1){
delete_timer(character->waiting_disconnect, chardb_waiting_disconnect);