Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete a char when he his in a guild cause crash #971

Closed
Jhobean opened this issue Dec 3, 2022 · 1 comment
Closed

Delete a char when he his in a guild cause crash #971

Jhobean opened this issue Dec 3, 2022 · 1 comment

Comments

@Jhobean
Copy link
Contributor

Jhobean commented Dec 3, 2022

If you join a guild and after that delete your char, When a legit guild member go touch the guild stone (i_guildstone), You will get a critical warning. If you run shard in debug, server just crash.

image

image

I think the fix could be done here but I dont know how.

if ( GetLinkUID().IsChar() )
{
switch ( iIndex )
{
case STMM_ISCANDIDATE:
sVal.FormatVal((GetPriv() == STONEPRIV_CANDIDATE) ? 1 : 0);
break;
case STMM_ISMASTER:
sVal.FormatVal(IsPrivMaster());
break;
case STMM_ISMEMBER:
sVal.FormatVal(IsPrivMember());
break;
case STMM_ACCOUNTGOLD:
sVal.FormatVal(GetAccountGold());
break;
case STMM_LOYALTO:
sVal.FormatHex(GetLoyalToUID());
break;
case STMM_PRIV:
sVal.FormatVal(GetPriv());
break;
case STMM_PRIVNAME:
sVal = GetPrivName();
break;
case STMM_TITLE:
sVal = GetTitle();
break;
case STMM_SHOWABBREV:
sVal.FormatVal(IsAbbrevOn());
break;
default:
if (!fNoCallParent)
{
CScriptObj *pRef = GetLinkUID().CharFind();
return pRef->r_WriteVal(ptcKey,sVal,pSrc);
}

I think there 2 bug. One in server where he can scan an invalid UID and one in script where he dont delete invalid member.

@drk84 drk84 self-assigned this Dec 3, 2022
drk84 added a commit to drk84/Source2 that referenced this issue Dec 3, 2022
…ssue Sphereserver#971).

When a player is deleted, the ClearPlayer method is called before the character destructor, in this method the m_pPlayer property is set to null and this cause the Guild_Resign method (found in the character destructor) to fail and not deleting the player from the guild.

So i just moved the Guild_Resign method from the destructor to the ClearPlayer method.
drk84 added a commit to drk84/Source2 that referenced this issue Dec 3, 2022
…h. (Issue Sphereserver#971).

When a player is deleted the ClearPlayer method is called and this set the m_pPlayer property to null. When a deleted player is inside a guild, the Guild_Resign method will fail because this method relies upon the m_pPlayer to succeed (and the destructor is called after ClearPlayer).

So i just moved the Guild_Resign method in the ClearPlayer before the m_pPlayer property is set to null.
drk84 added a commit that referenced this issue Dec 3, 2022
…h. (Issue #971). (#972)

When a player is deleted the ClearPlayer method is called and this set the m_pPlayer property to null. When a deleted player is inside a guild, the Guild_Resign method will fail because this method relies upon the m_pPlayer to succeed (and the destructor is called after ClearPlayer).

So i just moved the Guild_Resign method in the ClearPlayer before the m_pPlayer property is set to null.
@drk84
Copy link
Member

drk84 commented Dec 3, 2022

fix sent

@Jhobean Jhobean closed this as completed Dec 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants