From f878d5e2156dc88fb73d27473acfe01d72427bbd Mon Sep 17 00:00:00 2001 From: Haru Date: Mon, 28 Dec 2015 00:16:39 +0100 Subject: 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 --- src/map/npc_chat.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/map/npc_chat.c') 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; -- cgit v1.2.3-60-g2f50