summaryrefslogtreecommitdiff
path: root/src/map/mapreg_sql.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-04-05 13:15:04 +0200
committerHaru <haru@dotalux.com>2016-04-05 13:15:04 +0200
commit187c0b6b288a6a4267aeb949e054dd8fabde6627 (patch)
treec3bbb6a5999659f2da840563fa6f46a517677145 /src/map/mapreg_sql.c
parent73a617651b290eef4d5c1e6900eed6cb3526c307 (diff)
parentc3eb11ff4c048a5ff6770dc57659ed7798576a97 (diff)
downloadhercules-187c0b6b288a6a4267aeb949e054dd8fabde6627.tar.gz
hercules-187c0b6b288a6a4267aeb949e054dd8fabde6627.tar.bz2
hercules-187c0b6b288a6a4267aeb949e054dd8fabde6627.tar.xz
hercules-187c0b6b288a6a4267aeb949e054dd8fabde6627.zip
Merge pull request #1237 from 4144/mapchecks
Add missing checks into some files in map server
Diffstat (limited to 'src/map/mapreg_sql.c')
-rw-r--r--src/map/mapreg_sql.c7
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