summaryrefslogtreecommitdiff
path: root/src/map/unit.c
diff options
context:
space:
mode:
authorskyleo <skyleo@skyleo.de>2019-12-02 18:26:42 +0100
committerHaru <haru@dotalux.com>2020-03-08 20:59:35 +0100
commit88cca0d976bdd6fbe07c8646939fc1512e97cf72 (patch)
treefc242455a9647cf4e5b82b0a9b86cd86ac620968 /src/map/unit.c
parentdad727a34acf286ef0f30ca0ee396d3e106be2ec (diff)
downloadhercules-88cca0d976bdd6fbe07c8646939fc1512e97cf72.tar.gz
hercules-88cca0d976bdd6fbe07c8646939fc1512e97cf72.tar.bz2
hercules-88cca0d976bdd6fbe07c8646939fc1512e97cf72.tar.xz
hercules-88cca0d976bdd6fbe07c8646939fc1512e97cf72.zip
Handle not known values of bl->type with assertion
Diffstat (limited to 'src/map/unit.c')
-rw-r--r--src/map/unit.c5
1 files changed, 4 insertions, 1 deletions
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);
}
}