diff options
author | Haru <haru@dotalux.com> | 2015-12-28 00:16:39 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2016-01-06 15:14:50 +0100 |
commit | f878d5e2156dc88fb73d27473acfe01d72427bbd (patch) | |
tree | 7bcb5cd894ffd776545f4fe480276476c7688252 /src/map/npc_chat.c | |
parent | b3c722ecf777aeeea6317755a6adfc0216b7a2bd (diff) | |
download | hercules-f878d5e2156dc88fb73d27473acfe01d72427bbd.tar.gz hercules-f878d5e2156dc88fb73d27473acfe01d72427bbd.tar.bz2 hercules-f878d5e2156dc88fb73d27473acfe01d72427bbd.tar.xz hercules-f878d5e2156dc88fb73d27473acfe01d72427bbd.zip |
Replaced some explicit casts with BL_UCAST/BL_UCCAST
- Replaced casts in foreach callbacks.
- Added assertions and nullpo checks where applicable.
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/npc_chat.c')
-rw-r--r-- | src/map/npc_chat.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/map/npc_chat.c b/src/map/npc_chat.c index 8950df1ee..db300e362 100644 --- a/src/map/npc_chat.c +++ b/src/map/npc_chat.c @@ -339,15 +339,20 @@ void npc_chat_finalize(struct npc_data* nd) */ int npc_chat_sub(struct block_list* bl, va_list ap) { - struct npc_data *nd = (struct npc_data *) bl; - struct npc_parse *npcParse = nd->chatdb; - char* msg; + struct npc_data *nd = NULL; + struct npc_parse *npcParse = NULL; + char *msg; int len, i; struct map_session_data* sd; struct npc_label_list* lst; struct pcrematch_set* pcreset; struct pcrematch_entry* e; + nullpo_ret(bl); + Assert_ret(bl->type == BL_NPC); + nd = BL_UCAST(BL_NPC, bl); + npcParse = nd->chatdb; + // Not interested in anything you might have to say... if (npcParse == NULL || npcParse->active == NULL) return 0; |