summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDastgir <dastgirp@gmail.com>2020-01-25 17:15:36 +0530
committerJesusaves <cpntb1@ymail.com>2021-02-15 17:30:45 -0300
commit6baeef06ce06287f163d2c93e05d21ed9fd08d51 (patch)
tree2185b5178d63bb041d23f9bfb4e621181b0be930
parent813042cc7da5f142962b7872244dea8504da7919 (diff)
downloadhercules-6baeef06ce06287f163d2c93e05d21ed9fd08d51.tar.gz
hercules-6baeef06ce06287f163d2c93e05d21ed9fd08d51.tar.bz2
hercules-6baeef06ce06287f163d2c93e05d21ed9fd08d51.tar.xz
hercules-6baeef06ce06287f163d2c93e05d21ed9fd08d51.zip
Added a check in getunits to not proceed if mapname is invalid.
-rw-r--r--src/map/script.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c
index cf2a0c2d1..8a9236d34 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -11645,6 +11645,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);