summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-09-18 15:55:39 +0200
committerHaru <haru@dotalux.com>2015-09-18 15:56:05 +0200
commit9e2ae37d45a32a5dfcca2fc77ed61703d31dc468 (patch)
tree144d295dada9c1843635fcb30b5f50f3ac43c74f /src/map/clif.c
parentd0168b5e1243361afd875ee723003195c977a770 (diff)
downloadhercules-9e2ae37d45a32a5dfcca2fc77ed61703d31dc468.tar.gz
hercules-9e2ae37d45a32a5dfcca2fc77ed61703d31dc468.tar.bz2
hercules-9e2ae37d45a32a5dfcca2fc77ed61703d31dc468.tar.xz
hercules-9e2ae37d45a32a5dfcca2fc77ed61703d31dc468.zip
Follow-up to 21442a885b1214e1b6a2f23a2553da416fb97238
Corrected a nullpo check in the clif_party_withdraw function (in some cases, it is acceptable for sd to be NULL -- documentation is still lacking though) Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index d1b20a750..991c9a0e7 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -6615,19 +6615,18 @@ void clif_party_withdraw(struct party_data* p, struct map_session_data* sd, int
unsigned char buf[64];
nullpo_retv(p);
- nullpo_retv(sd);
nullpo_retv(name);
- if(!sd && (flag&0xf0)==0)
- {
+ if(!sd && (flag&0xf0)==0) { // TODO: Document this flag
int i;
- for(i=0;i<MAX_PARTY && !p->data[i].sd;i++)
- ;
- if (i < MAX_PARTY)
- sd = p->data[i].sd;
+ // Search for any online party member
+ ARR_FIND(0, MAX_PARTY, i, p->data[i].sd != NULL);
+ if (i != MAX_PARTY)
+ sd = p->data[i].sd;
}
- if(!sd) return;
+ if (!sd)
+ return;
WBUFW(buf,0)=0x105;
WBUFL(buf,2)=account_id;