From 88cca0d976bdd6fbe07c8646939fc1512e97cf72 Mon Sep 17 00:00:00 2001 From: skyleo Date: Mon, 2 Dec 2019 18:26:42 +0100 Subject: Handle not known values of bl->type with assertion --- src/map/unit.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/map/unit.c b/src/map/unit.c index 96222a62f..28f81017f 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -72,6 +72,9 @@ struct unit_interface *unit; /** * Returns the unit_data for the given block_list. If the object is using * shared unit_data (i.e. in case of BL_NPC), it returns the shared data. + * + * __Warning:__ if bl->type is not known or NULL, + * an assertion will be triggered and NULL returned. * @param bl block_list to process, it is expected to be not NULL. * @return a pointer to the given object's unit_data **/ @@ -94,7 +97,7 @@ static struct unit_data *unit_bl2ud(struct block_list *bl) case BL_ELEM: return &BL_UCAST(BL_ELEM, bl)->ud; default: - return NULL; + Assert_retr(NULL, false); } } -- cgit v1.2.3-60-g2f50