diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/map/map.c | 5 | ||||
-rw-r--r-- | src/map/script.c | 7 |
2 files changed, 11 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); diff --git a/src/map/script.c b/src/map/script.c index b89176dba..875f193eb 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -11775,6 +11775,13 @@ static BUILDIN(getunits) const char *mapname = script_getstr(st, 5); int16 m = map->mapname2mapid(mapname); + if (m == -1) { + ShowError("script:getunits: Invalid map(%s) provided.\n", mapname); + script->reportdata(data); + st->state = END; + return false; + } + if (script_hasdata(st, 9)) { int16 x1 = script_getnum(st, 6); int16 y1 = script_getnum(st, 7); |