diff options
author | skyleo <skyleo@skyleo.de> | 2019-12-02 18:26:42 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2020-03-08 20:59:35 +0100 |
commit | 88cca0d976bdd6fbe07c8646939fc1512e97cf72 (patch) | |
tree | fc242455a9647cf4e5b82b0a9b86cd86ac620968 | |
parent | dad727a34acf286ef0f30ca0ee396d3e106be2ec (diff) | |
download | hercules-88cca0d976bdd6fbe07c8646939fc1512e97cf72.tar.gz hercules-88cca0d976bdd6fbe07c8646939fc1512e97cf72.tar.bz2 hercules-88cca0d976bdd6fbe07c8646939fc1512e97cf72.tar.xz hercules-88cca0d976bdd6fbe07c8646939fc1512e97cf72.zip |
Handle not known values of bl->type with assertion
-rw-r--r-- | src/map/unit.c | 5 |
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); } } |