diff options
author | Dastgir <dastgirp@gmail.com> | 2020-01-25 17:18:37 +0530 |
---|---|---|
committer | Dastgir <dastgirp@gmail.com> | 2020-01-25 17:18:37 +0530 |
commit | f2f6fdec4be88cc1fcb82d7882f3a2fcf0cad7bf (patch) | |
tree | e915768f875f144df46fb18c3f4171fd2d3fa5a9 /src/map/map.c | |
parent | 7afdbbbad8d74f6a4a85417c99f114099a4930b8 (diff) | |
download | hercules-f2f6fdec4be88cc1fcb82d7882f3a2fcf0cad7bf.tar.gz hercules-f2f6fdec4be88cc1fcb82d7882f3a2fcf0cad7bf.tar.bz2 hercules-f2f6fdec4be88cc1fcb82d7882f3a2fcf0cad7bf.tar.xz hercules-f2f6fdec4be88cc1fcb82d7882f3a2fcf0cad7bf.zip |
map_forcountinmap will return 0 if invalid mapindex is provided
Diffstat (limited to 'src/map/map.c')
-rw-r--r-- | src/map/map.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/map/map.c b/src/map/map.c index afdc2ed41..8639a2a8b 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -638,9 +638,12 @@ static int map_foreachinmap(int (*func)(struct block_list*, va_list), int16 m, i static int map_forcountinmap(int (*func)(struct block_list*, va_list), int16 m, int count, int type, ...) { - int returnCount; + int returnCount = 0; va_list ap; + if (m < 0) + return returnCount; + va_start(ap, type); returnCount = map->vforcountinarea(func, m, 0, 0, map->list[m].xs, map->list[m].ys, count, type, ap); va_end(ap); |