summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKevin <Kevin@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-04-07 05:36:36 +0000
committerKevin <Kevin@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-04-07 05:36:36 +0000
commit1f1f468a783b8782eb1eae2c9f4a9c96adefe8ef (patch)
treee089ea64314452de288b0884b94a7b071be85dad /src
parentbb0522001e835ead594ca80c386c2d10db7fe124 (diff)
downloadhercules-1f1f468a783b8782eb1eae2c9f4a9c96adefe8ef.tar.gz
hercules-1f1f468a783b8782eb1eae2c9f4a9c96adefe8ef.tar.bz2
hercules-1f1f468a783b8782eb1eae2c9f4a9c96adefe8ef.tar.xz
hercules-1f1f468a783b8782eb1eae2c9f4a9c96adefe8ef.zip
Fixed a case where a dangling pointer was formed when a person was invited to a party immediately after creating their own. (bugreport:1180)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12518 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/party.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/map/party.c b/src/map/party.c
index 2d81e155c..1d59c476e 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -114,6 +114,9 @@ int party_create(struct map_session_data *sd,char *name,int item,int item2)
return 0; // "already in a party"
}
+ //Temporarily set to -1 so cannot be spam invited
+ sd->status.party_id = -1;
+
party_fill_member(&leader, sd);
leader.leader = 1;
@@ -129,6 +132,8 @@ void party_created(int account_id,int char_id,int fail,int party_id,char *name)
if (!sd || sd->status.char_id != char_id)
{ //Character logged off before creation ack?
+ if(sd)
+ sd->status.party_id = 0;
if (!fail) //break up party since player could not be added to it.
intif_party_leave(party_id,account_id,char_id);
return;
@@ -139,6 +144,7 @@ void party_created(int account_id,int char_id,int fail,int party_id,char *name)
clif_party_created(sd,0); //Success message
//We don't do any further work here because the char-server sends a party info packet right after creating the party.
} else {
+ sd->status.party_id = 0;
clif_party_created(sd,1); // "party name already exists"
}
}
@@ -299,7 +305,7 @@ int party_invite(struct map_session_data *sd,struct map_session_data *tsd)
return 0;
}
- if( tsd->status.party_id>0 || tsd->party_invite>0 ){
+ if( tsd->status.party_id!=0 || tsd->party_invite>0){
clif_party_inviteack(sd,tsd->status.name,0);
return 0;
}