summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-02-24 21:46:27 +0300
committerAndrei Karas <akaras@inbox.ru>2015-02-24 21:46:27 +0300
commite2fec6a64a403df523d64540f70c73b99fbf491c (patch)
tree34ee4d272252990071bd84cff303b956e4b57c21 /src/map/script.c
parentcf9c4ca35fefcf392269179785371b679689364c (diff)
downloadevol-hercules-e2fec6a64a403df523d64540f70c73b99fbf491c.tar.gz
evol-hercules-e2fec6a64a403df523d64540f70c73b99fbf491c.tar.bz2
evol-hercules-e2fec6a64a403df523d64540f70c73b99fbf491c.tar.xz
evol-hercules-e2fec6a64a403df523d64540f70c73b99fbf491c.zip
map: add missing checks.
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 8c8f946..8017ed1 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -139,10 +139,24 @@ BUILDIN(npcTalk3)
return false;
}
+ if (!str)
+ {
+ ShowWarning("error in string\n");
+ script->reportsrc(st);
+ return false;
+ }
+
if (sd)
msg = (char*)lang_pctrans (nd->name, sd);
else
msg = nd->name;
+
+ if (!msg)
+ {
+ ShowWarning("error in string\n");
+ script->reportsrc(st);
+ return false;
+ }
if (strlen(str) + strlen(msg) > 450)
{
ShowWarning("text message too big\n");
@@ -273,9 +287,7 @@ BUILDIN(requestLang)
int lng = -1;
if (*sd->npc_str)
- {
lng = lang_getId(sd->npc_str);
- }
script->set_reg(st, sd, uid, name, (void*)h64BPTRSIZE(lng), script_getref(st,2));
st->state = RUN;
}
@@ -934,6 +946,9 @@ BUILDIN(areaTimer)
static int buildin_getareadropitem_sub_del(struct block_list *bl, va_list ap)
{
+ if (!bl)
+ return 0;
+
const int item = va_arg(ap, int);
int *const amount = va_arg(ap, int *);
struct flooritem_data *drop = (struct flooritem_data *)bl;