summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-05-21 15:59:59 +0200
committerHaru <haru@dotalux.com>2014-05-21 15:59:59 +0200
commitcd1be22f3a10c2da4817ebf10cd1425f443c6a10 (patch)
tree071e2e1b14ad674e06e8f0191af055b3aa4c999b /src
parentbd86d05a59e9680ff8c645854a546617a9caaf2e (diff)
downloadhercules-cd1be22f3a10c2da4817ebf10cd1425f443c6a10.tar.gz
hercules-cd1be22f3a10c2da4817ebf10cd1425f443c6a10.tar.bz2
hercules-cd1be22f3a10c2da4817ebf10cd1425f443c6a10.tar.xz
hercules-cd1be22f3a10c2da4817ebf10cd1425f443c6a10.zip
Corrected a nullpo report in 4c8d773d72ae134f7cc4d43861104ecd9f4ae134
Special thanks to ossi0110 Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src')
-rw-r--r--src/map/skill.c12
-rw-r--r--src/map/skill.h4
-rw-r--r--src/map/status.c2
3 files changed, 7 insertions, 11 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index 90c0bbec6..383720361 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -15289,15 +15289,14 @@ bool skill_check_cloaking(struct block_list *bl, struct status_change_entry *sce
/**
* Verifies if an user can use SC_CLOAKING
**/
-bool skill_can_cloak(struct map_session_data *sd, struct block_list *bl) {
+bool skill_can_cloak(struct map_session_data *sd) {
nullpo_retr(false, sd);
- nullpo_retr(false, bl);
//Avoid cloaking with no wall and low skill level. [Skotlex]
//Due to the cloaking card, we have to check the wall versus to known
//skill level rather than the used one. [Skotlex]
//if (sd && val1 < 3 && skill_check_cloaking(bl,NULL))
- if( sd && pc->checkskill(sd, AS_CLOAKING) < 3 && !skill->check_cloaking(bl,NULL) )
+ if (pc->checkskill(sd, AS_CLOAKING) < 3 && !skill->check_cloaking(&sd->bl,NULL))
return false;
return true;
@@ -15308,12 +15307,9 @@ bool skill_can_cloak(struct map_session_data *sd, struct block_list *bl) {
* Is called via map->foreachinrange when any kind of wall disapears
**/
int skill_check_cloaking_end(struct block_list *bl, va_list ap) {
- TBL_PC *sd = (TBL_PC*)bl;
-
- if( bl == NULL || sd == NULL )
- return 0;
+ TBL_PC *sd = BL_CAST(BL_PC, bl);
- if( sd->sc.data[SC_CLOAKING] && !skill_can_cloak(sd, bl) )
+ if (sd && sd->sc.data[SC_CLOAKING] && !skill->can_cloak(sd))
status_change_end(bl, SC_CLOAKING, INVALID_TIMER);
return 0;
diff --git a/src/map/skill.h b/src/map/skill.h
index 6939eda42..6666fbbf2 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -1918,8 +1918,8 @@ struct skill_interface {
int (*autospell) (struct map_session_data *md,uint16 skill_id);
int (*calc_heal) (struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, bool heal);
bool (*check_cloaking) (struct block_list *bl, struct status_change_entry *sce);
- int (*check_cloaking_end) (struct block_list *bl, va_list);
- bool (*can_cloak) (struct map_session_data *sd, struct block_list *bl);
+ int (*check_cloaking_end) (struct block_list *bl, va_list ap);
+ bool (*can_cloak) (struct map_session_data *sd);
int (*enchant_elemental_end) (struct block_list *bl, int type);
int (*not_ok) (uint16 skill_id, struct map_session_data *sd);
int (*not_ok_hom) (uint16 skill_id, struct homun_data *hd);
diff --git a/src/map/status.c b/src/map/status.c
index e76cd86a3..a1a7e1969 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -6944,7 +6944,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
return 0;
break;
case SC_CLOAKING:
- if( !skill->can_cloak(sd, bl) )
+ if (sd && !skill->can_cloak(sd))
return 0;
break;
case SC_MODECHANGE: