summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
authorDastgir <dastgirp@gmail.com>2020-01-25 17:18:37 +0530
committerDastgir <dastgirp@gmail.com>2020-01-25 17:18:37 +0530
commitf2f6fdec4be88cc1fcb82d7882f3a2fcf0cad7bf (patch)
treee915768f875f144df46fb18c3f4171fd2d3fa5a9 /src/map/map.c
parent7afdbbbad8d74f6a4a85417c99f114099a4930b8 (diff)
downloadhercules-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.c5
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);