summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-07-08 19:24:48 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-07-08 19:24:48 +0000
commit1f8c922a8ffd8fb216c050b86fdbc4040e5780f6 (patch)
treeabb64c4c336461951245ff717dc88820a4e14dd2 /src/map/pc.c
parent26659b5a9d4910fd960174690fe899111dd67ba6 (diff)
downloadhercules-1f8c922a8ffd8fb216c050b86fdbc4040e5780f6.tar.gz
hercules-1f8c922a8ffd8fb216c050b86fdbc4040e5780f6.tar.bz2
hercules-1f8c922a8ffd8fb216c050b86fdbc4040e5780f6.tar.xz
hercules-1f8c922a8ffd8fb216c050b86fdbc4040e5780f6.zip
* Fixed typo in 'deletearray' messing up the script engine
* Added a check to pc_skill() to prevent crashes on unknown skill ids git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10868 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 79a898cff..49d880767 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -2494,11 +2494,17 @@ int pc_skill(TBL_PC* sd, int id, int level, int flag)
{
nullpo_retr(0, sd);
- if( level > MAX_SKILL_LEVEL ){
+ if( id <= 0 || id >= MAX_SKILL || skill_db[id].name == NULL) {
if( battle_config.error_log )
- ShowError("pc_skill: Skill level %d too high. Max lv supported is MAX_SKILL_LEVEL (%d)\n", level, MAX_SKILL_LEVEL);
+ ShowError("pc_skill: Skill with id %d does not exist in the skill database\n", id);
return 0;
}
+ if( level > MAX_SKILL_LEVEL ) {
+ if( battle_config.error_log )
+ ShowError("pc_skill: Skill level %d too high. Max lv supported is %d\n", level, MAX_SKILL_LEVEL);
+ return 0;
+ }
+
switch( flag ){
case 0: //Set skill data overwriting whatever was there before.
sd->status.skill[id].id = id;