diff options
author | Michieru <Michieru@users.noreply.github.com> | 2014-09-16 20:46:41 +0200 |
---|---|---|
committer | Michieru <Michieru@users.noreply.github.com> | 2014-09-16 20:46:41 +0200 |
commit | 219c35e699b03da7939c207627c09a70614a1b7b (patch) | |
tree | dd420dbda4a5e0b93fbf38dd53644db69cfbd7cc | |
parent | 807e5b26b5d532a79d147e7710fe326ca95b50ce (diff) | |
download | hercules-219c35e699b03da7939c207627c09a70614a1b7b.tar.gz hercules-219c35e699b03da7939c207627c09a70614a1b7b.tar.bz2 hercules-219c35e699b03da7939c207627c09a70614a1b7b.tar.xz hercules-219c35e699b03da7939c207627c09a70614a1b7b.zip |
"Fixes char server crash when saving ##variables while login server is offline, thanks to Ancyker"
Fix made by Ind :)
-rw-r--r-- | src/char/inter.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/char/inter.c b/src/char/inter.c index a7794c9c9..e5a7d411c 100644 --- a/src/char/inter.c +++ b/src/char/inter.c @@ -694,7 +694,11 @@ void mapif_parse_accinfo2(bool success, int map_fd, int u_fd, int u_aid, int acc void inter_savereg(int account_id, int char_id, const char *key, unsigned int index, intptr_t val, bool is_string) { /* to login server we go! */ if( key[0] == '#' && key[1] == '#' ) {/* global account reg */ - global_accreg_to_login_add(key,index,val,is_string); + if( session_isValid(login_fd) ) + global_accreg_to_login_add(key,index,val,is_string); + else { + ShowError("Login server unavailable, cant perform update on '%s' variable for AID:%d CID:%d\n",key,account_id,char_id); + } } else if ( key[0] == '#' ) {/* local account reg */ if( is_string ) { if( val ) { @@ -1301,8 +1305,10 @@ int mapif_parse_Registry(int fd) int cursor = 14, i; char key[32], sval[254]; unsigned int index; - - global_accreg_to_login_start(account_id,char_id); + bool isLoginActive = session_isActive(login_fd); + + if( isLoginActive ) + global_accreg_to_login_start(account_id,char_id); for(i = 0; i < count; i++) { safestrncpy(key, (char*)RFIFOP(fd, cursor + 1), RFIFOB(fd, cursor)); @@ -1336,8 +1342,9 @@ int mapif_parse_Registry(int fd) } } - - global_accreg_to_login_send(); + + if( isLoginActive ) + global_accreg_to_login_send(); } return 0; } |