summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-03-30 20:58:25 +0300
committerAndrei Karas <akaras@inbox.ru>2015-04-09 11:52:32 +0300
commit8e2c71ea78e461b4a9274d22bcb3039bf6ec3584 (patch)
treeeb3b0f44c0b75c4b36f88c24d8d4ee398730a873 /src
parentfb9f8cadf5ebe6c6d2fce3106a917cbd8956695d (diff)
downloadhercules-8e2c71ea78e461b4a9274d22bcb3039bf6ec3584.tar.gz
hercules-8e2c71ea78e461b4a9274d22bcb3039bf6ec3584.tar.bz2
hercules-8e2c71ea78e461b4a9274d22bcb3039bf6ec3584.tar.xz
hercules-8e2c71ea78e461b4a9274d22bcb3039bf6ec3584.zip
Add checks to int_elements.c
Diffstat (limited to 'src')
-rw-r--r--src/char/int_elemental.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/char/int_elemental.c b/src/char/int_elemental.c
index d14d1e1e0..3a5022fe4 100644
--- a/src/char/int_elemental.c
+++ b/src/char/int_elemental.c
@@ -15,6 +15,7 @@
#include "mapif.h"
#include "../common/malloc.h"
#include "../common/mmo.h"
+#include "../common/nullpo.h"
#include "../common/showmsg.h"
#include "../common/socket.h"
#include "../common/sql.h"
@@ -26,6 +27,7 @@ struct inter_elemental_interface inter_elemental_s;
bool mapif_elemental_save(struct s_elemental* ele) {
bool flag = true;
+ nullpo_retr(false, ele);
if( ele->elemental_id == 0 ) { // Create new DB entry
if( SQL_ERROR == SQL->Query(inter->sql_handle,
"INSERT INTO `%s` (`char_id`,`class`,`mode`,`hp`,`sp`,`max_hp`,`max_sp`,`atk1`,`atk2`,`matk`,`aspd`,`def`,`mdef`,`flee`,`hit`,`life_time`)"
@@ -53,6 +55,7 @@ bool mapif_elemental_save(struct s_elemental* ele) {
bool mapif_elemental_load(int ele_id, int char_id, struct s_elemental *ele) {
char* data;
+ nullpo_retr(false, ele);
memset(ele, 0, sizeof(struct s_elemental));
ele->elemental_id = ele_id;
ele->char_id = char_id;
@@ -105,6 +108,7 @@ bool mapif_elemental_delete(int ele_id) {
void mapif_elemental_send(int fd, struct s_elemental *ele, unsigned char flag) {
int size = sizeof(struct s_elemental) + 5;
+ nullpo_retv(ele);
WFIFOHEAD(fd,size);
WFIFOW(fd,0) = 0x387c;
WFIFOW(fd,2) = size;