summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2020-05-13 02:02:49 +0300
committerAndrei Karas <akaras@inbox.ru>2020-06-01 01:08:50 +0300
commit943fd8d27b09ece510c537523147d971c90a6644 (patch)
treeed039541c2fa87226acc483fa4c0c02010655b80
parent26f926c8b33bb7b501e2a291364b8c07a9a50ae6 (diff)
downloadhercules-943fd8d27b09ece510c537523147d971c90a6644.tar.gz
hercules-943fd8d27b09ece510c537523147d971c90a6644.tar.bz2
hercules-943fd8d27b09ece510c537523147d971c90a6644.tar.xz
hercules-943fd8d27b09ece510c537523147d971c90a6644.zip
Add missing vd checks into status.c
-rw-r--r--src/map/status.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/map/status.c b/src/map/status.c
index a6e6b24c0..fe1514f7e 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -6407,13 +6407,24 @@ static int status_get_class(const struct block_list *bl)
{
nullpo_ret(bl);
switch (bl->type) {
- case BL_PC: return BL_UCCAST(BL_PC, bl)->status.class;
- case BL_MOB: return BL_UCCAST(BL_MOB, bl)->vd->class; //Class used on all code should be the view class of the mob.
- case BL_PET: return BL_UCCAST(BL_PET, bl)->pet.class_;
- case BL_HOM: return BL_UCCAST(BL_HOM, bl)->homunculus.class_;
- case BL_MER: return BL_UCCAST(BL_MER, bl)->mercenary.class_;
- case BL_NPC: return BL_UCCAST(BL_NPC, bl)->class_;
- case BL_ELEM: return BL_UCCAST(BL_ELEM, bl)->elemental.class_;
+ case BL_PC:
+ return BL_UCCAST(BL_PC, bl)->status.class;
+ case BL_MOB:
+ {
+ const struct view_data *const vd = BL_UCCAST(BL_MOB, bl)->vd;
+ nullpo_ret(vd);
+ return vd->class; //Class used on all code should be the view class of the mob.
+ }
+ case BL_PET:
+ return BL_UCCAST(BL_PET, bl)->pet.class_;
+ case BL_HOM:
+ return BL_UCCAST(BL_HOM, bl)->homunculus.class_;
+ case BL_MER:
+ return BL_UCCAST(BL_MER, bl)->mercenary.class_;
+ case BL_NPC:
+ return BL_UCCAST(BL_NPC, bl)->class_;
+ case BL_ELEM:
+ return BL_UCCAST(BL_ELEM, bl)->elemental.class_;
}
return 0;
}