summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2020-02-09 23:07:31 +0100
committerGitHub <noreply@github.com>2020-02-09 23:07:31 +0100
commit66b624165ba2e7c868b38081230a61691be447df (patch)
tree77b4c11f6500772c2e8b7106d3d1533d0fe07f42 /src/map/map.c
parentc4ab59ff86fc12d1e7643bbe55a2149c8dc0e56a (diff)
parentf2f6fdec4be88cc1fcb82d7882f3a2fcf0cad7bf (diff)
downloadhercules-66b624165ba2e7c868b38081230a61691be447df.tar.gz
hercules-66b624165ba2e7c868b38081230a61691be447df.tar.bz2
hercules-66b624165ba2e7c868b38081230a61691be447df.tar.xz
hercules-66b624165ba2e7c868b38081230a61691be447df.zip
Merge pull request #2619 from dastgirp/getunits/fix
Crash fixes
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 8b52fc761..33f3fe716 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);