Added extra safeguards against invalid inputs to pc_equipitem / pc_unequipitem (bugreport:1568).
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12739 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
aaf715d0b5
commit
af570158d8
13
src/map/pc.c
13
src/map/pc.c
@ -6331,6 +6331,11 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
|
||||
|
||||
nullpo_retr(0, sd);
|
||||
|
||||
if( n < 0 || n >= MAX_INVENTORY ) {
|
||||
clif_equipitemack(sd,0,0,0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
id = sd->inventory_data[n];
|
||||
pos = pc_equippoint(sd,n); //With a few exceptions, item should go in all specified slots.
|
||||
|
||||
@ -6481,8 +6486,12 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag)
|
||||
int i;
|
||||
nullpo_retr(0, sd);
|
||||
|
||||
// -- moonsoul (if player is berserk then cannot unequip)
|
||||
//
|
||||
if( n < 0 || n >= MAX_INVENTORY ) {
|
||||
clif_unequipitemack(sd,0,0,0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// if player is berserk then cannot unequip
|
||||
if(!(flag&2) && sd->sc.count && (sd->sc.data[SC_BLADESTOP] || sd->sc.data[SC_BERSERK])){
|
||||
clif_unequipitemack(sd,n,0,0);
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user