summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoramber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-11-30 02:37:15 +0000
committeramber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-11-30 02:37:15 +0000
commitda40dffa8f2fc4bb37b08142a83974c48aa374cc (patch)
treec1dd3148e08ec465841ea20c5fdeb853d8e3d122
parente038fbc943a6b2ae4f6890c02b497b51329962e3 (diff)
downloadhercules-da40dffa8f2fc4bb37b08142a83974c48aa374cc.tar.gz
hercules-da40dffa8f2fc4bb37b08142a83974c48aa374cc.tar.bz2
hercules-da40dffa8f2fc4bb37b08142a83974c48aa374cc.tar.xz
hercules-da40dffa8f2fc4bb37b08142a83974c48aa374cc.zip
fixed another char crash
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@418 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog.txt1
-rw-r--r--src/char_sql/char.c9
2 files changed, 7 insertions, 3 deletions
diff --git a/Changelog.txt b/Changelog.txt
index d9d927469..5f3e76ac4 100644
--- a/Changelog.txt
+++ b/Changelog.txt
@@ -1,5 +1,6 @@
Date Added
11/29
+ * Fixed crash in src/char_sql/char.c when setting chars offline [MouseJstr]
* Added mapbug.txt which is displayed in map-server, displays
the last bug or w/e fixed for the map-server [MC Cameri]
-You may change it whenever you want
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index f944eeb58..c23c45bdb 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -201,10 +201,12 @@ void set_char_offline(int char_id, int account_id) {
if (mysql_query(&mysql_handle, tmp_sql))
printf("DB server Error (set_char_offline)- %s\n", mysql_error(&mysql_handle));
+ if (login_fd <= 0 || session[login_fd]->eof)
+ return;
+
WFIFOW(login_fd,0) = 0x272c;
WFIFOL(login_fd,2) = account_id;
WFIFOSET(login_fd,6);
-
}
//-----------------------------------------------------
@@ -2048,12 +2050,13 @@ int parse_char(int fd) {
sd = session[fd]->session_data;
- if(login_fd < 0)
+ if(login_fd < 0)
session[fd]->eof = 1;
if(session[fd]->eof) {
if (fd == login_fd)
login_fd = -1;
- set_char_offline(99,sd->account_id);
+ if (sd != NULL)
+ set_char_offline(99,sd->account_id);
close(fd);
delete_session(fd);
return 0;