diff options
author | Haru <haru@dotalux.com> | 2019-08-25 19:30:43 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2019-10-18 17:41:36 +0200 |
commit | 06df6b04187d6b7ee80876a7af0321ab5619eff6 (patch) | |
tree | 13d640ce9bc107d916e82be8379d1f255a1cdda2 | |
parent | ce64fd405d34b42ae2602dbd9345d42fd1dbaef0 (diff) | |
download | hercules-06df6b04187d6b7ee80876a7af0321ab5619eff6.tar.gz hercules-06df6b04187d6b7ee80876a7af0321ab5619eff6.tar.bz2 hercules-06df6b04187d6b7ee80876a7af0321ab5619eff6.tar.xz hercules-06df6b04187d6b7ee80876a7af0321ab5619eff6.zip |
Clear the cached guild pointer when the guild id is cleared upon error
Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r-- | src/map/guild.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/map/guild.c b/src/map/guild.c index 2faf60e2b..3b611bb05 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -565,6 +565,7 @@ static int guild_check_member(const struct guild *g) if (i == INDEX_NOT_FOUND) { sd->status.guild_id=0; sd->guild_emblem_id=0; + sd->guild = NULL; ShowWarning("guild: check_member %d[%s] is not member\n",sd->status.account_id,sd->status.name); } } @@ -581,8 +582,11 @@ static int guild_recv_noinfo(int guild_id) iter = mapit_getallusers(); for (sd = BL_UCAST(BL_PC, mapit->first(iter)); mapit->exists(iter); sd = BL_UCAST(BL_PC, mapit->next(iter))) { - if( sd->status.guild_id == guild_id ) + if (sd->status.guild_id == guild_id) { sd->status.guild_id = 0; // erase guild + sd->guild_emblem_id = 0; + sd->guild = NULL; + } } mapit->free(iter); @@ -872,6 +876,8 @@ static void guild_member_joined(struct map_session_data *sd) i = guild->getindex(g, sd->status.account_id, sd->status.char_id); if (i == INDEX_NOT_FOUND) { sd->status.guild_id = 0; + sd->guild_emblem_id = 0; + sd->guild = NULL; } else { g->member[i].sd = sd; sd->guild = g; |