summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt1
-rw-r--r--src/map/skill.c8
-rw-r--r--src/map/skill.h3
-rw-r--r--src/map/status.c9
4 files changed, 18 insertions, 3 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index bae7d4c8a..98d0611f9 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -1,6 +1,7 @@
Date Added
2010/12/17
+ * Added temporary check to skill_delunitgroup to prevent crashes when 'group' is NULL and added some debug messages to track down the source of the crash (bugreport:3504). [Ai4rei]
* Spellchecked script_commands.txt. [Ai4rei]
* Random script engine clean-ups that have accumulated over time. [Ai4rei]
- Resolved unnecessary script_getnum re-evaluation in a loop in script command 'npcshopdelitem' (since r7120).
diff --git a/src/map/skill.c b/src/map/skill.c
index e77703e1f..3c4cbcd21 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -10161,13 +10161,17 @@ struct skill_unit_group* skill_initunitgroup (struct block_list* src, int count,
/*==========================================
*
*------------------------------------------*/
-int skill_delunitgroup (struct skill_unit_group *group)
+int skill_delunitgroup_(struct skill_unit_group *group, const char* file, int line, const char* func)
{
struct block_list* src;
struct unit_data *ud;
int i,j;
- nullpo_ret(group);
+ if( group == NULL )
+ {
+ ShowDebug("skill_delunitgroup: group is NULL (source=%s:%d, %s)! Please report this! (#3504)\n", file, line, func);
+ return 0;
+ }
src=map_id2bl(group->src_id);
ud = unit_bl2ud(src);
diff --git a/src/map/skill.h b/src/map/skill.h
index 04f2e8d28..fc7877be3 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -272,7 +272,8 @@ struct skill_unit_group *skill_unitsetting(struct block_list* src, short skillid
struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int x, int y, int val1, int val2);
int skill_delunit(struct skill_unit *unit);
struct skill_unit_group *skill_initunitgroup(struct block_list* src, int count, short skillid, short skilllv, int unit_id, int limit, int interval);
-int skill_delunitgroup(struct skill_unit_group *group);
+int skill_delunitgroup_(struct skill_unit_group *group, const char* file, int line, const char* func);
+#define skill_delunitgroup(group) skill_delunitgroup_(group,__FILE__,__LINE__,__func__)
int skill_clear_unitgroup(struct block_list *src);
int skill_clear_group(struct block_list *bl, int flag);
diff --git a/src/map/status.c b/src/map/status.c
index 6778bf5b1..449ea8f56 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -6605,6 +6605,15 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
if(sce->val2)
{// erase associated land skill
group = skill_id2group(sce->val2);
+
+ if( group == NULL )
+ {
+ ShowDebug("status_change_end: SC_DANCING is missing skill unit group (val1=%d, val2=%d, val3=%d, val4=%d, timer=%d, tid=%d, char_id=%d, map=%s, x=%d, y=%d). Please report this! (#3504)\n",
+ sce->val1, sce->val2, sce->val3, sce->val4, sce->timer, tid,
+ sd ? sd->status.char_id : 0,
+ mapindex_id2name(map_id2index(bl->m)), bl->x, bl->y);
+ }
+
sce->val2 = 0;
skill_delunitgroup(group);
}