diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-01-07 00:28:29 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-04-04 17:48:55 +0300 |
commit | cf5855cc9c6571d6bca30c862496e6dd328b56f8 (patch) | |
tree | 9bc7084722250095d4d8521b67c64414553ab1a3 /src/map | |
parent | 5c5feb4aec096e02eaedbaa4a99d711845106758 (diff) | |
download | hercules-cf5855cc9c6571d6bca30c862496e6dd328b56f8.tar.gz hercules-cf5855cc9c6571d6bca30c862496e6dd328b56f8.tar.bz2 hercules-cf5855cc9c6571d6bca30c862496e6dd328b56f8.tar.xz hercules-cf5855cc9c6571d6bca30c862496e6dd328b56f8.zip |
Add missing checks into mapreg_sql.c
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/mapreg_sql.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/map/mapreg_sql.c b/src/map/mapreg_sql.c index 8a8f9f309..82ce39d64 100644 --- a/src/map/mapreg_sql.c +++ b/src/map/mapreg_sql.c @@ -28,6 +28,7 @@ #include "common/db.h" #include "common/ers.h" #include "common/memmgr.h" +#include "common/nullpo.h" #include "common/showmsg.h" #include "common/sql.h" #include "common/strlib.h" @@ -76,6 +77,7 @@ bool mapreg_setreg(int64 uid, int val) { unsigned int i = script_getvaridx(uid); const char* name = script->get_str(num); + nullpo_retr(true, name); if( val != 0 ) { if( (m = i64db_get(mapreg->regs.vars, uid)) ) { m->u.i = val; @@ -132,6 +134,8 @@ bool mapreg_setregstr(int64 uid, const char* str) { unsigned int i = script_getvaridx(uid); const char* name = script->get_str(num); + nullpo_retr(true, name); + if( str == NULL || *str == 0 ) { if( i ) script->array_update(&mapreg->regs, uid, true); @@ -246,6 +250,7 @@ void script_save_mapreg(void) int num = script_getvarid(m->uid); int i = script_getvaridx(m->uid); const char* name = script->get_str(num); + nullpo_retv(name); if (!m->is_string) { if( SQL_ERROR == SQL->Query(map->mysql_handle, "UPDATE `%s` SET `value`='%d' WHERE `varname`='%s' AND `index`='%d' LIMIT 1", mapreg->table, m->u.i, name, i) ) Sql_ShowDebug(map->mysql_handle); @@ -346,6 +351,8 @@ void mapreg_init(void) { * Loads the mapreg configuration file. */ bool mapreg_config_read(const char* w1, const char* w2) { + nullpo_retr(false, w1); + nullpo_retr(false, w2); if(!strcmpi(w1, "mapreg_db")) safestrncpy(mapreg->table, w2, sizeof(mapreg->table)); else |