diff options
Diffstat (limited to 'src/char/int_storage.c')
-rw-r--r-- | src/char/int_storage.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/src/char/int_storage.c b/src/char/int_storage.c index db49eb46e..a12d9fe17 100644 --- a/src/char/int_storage.c +++ b/src/char/int_storage.c @@ -4,22 +4,22 @@ #define HERCULES_CORE -#include "../config/core.h" // GP_BOUND_ITEMS +#include "config/core.h" // GP_BOUND_ITEMS #include "int_storage.h" +#include "char/char.h" +#include "char/inter.h" +#include "char/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" +#include "common/strlib.h" // StringBuf + #include <stdio.h> #include <stdlib.h> -#include <string.h> - -#include "char.h" -#include "inter.h" -#include "mapif.h" -#include "../common/malloc.h" -#include "../common/mmo.h" -#include "../common/showmsg.h" -#include "../common/socket.h" -#include "../common/sql.h" -#include "../common/strlib.h" // StringBuf #define STORAGE_MEMINC 16 @@ -28,6 +28,7 @@ struct inter_storage_interface inter_storage_s; /// Save storage data to sql int inter_storage_tosql(int account_id, struct storage_data* p) { + nullpo_ret(p); chr->memitemdata_to_sql(p->items, MAX_STORAGE, account_id, TABLE_STORAGE); return 0; } @@ -40,6 +41,7 @@ int inter_storage_fromsql(int account_id, struct storage_data* p) int i; int j; + nullpo_ret(p); memset(p, 0, sizeof(struct storage_data)); //clean up memory p->storage_amount = 0; @@ -82,6 +84,7 @@ int inter_storage_fromsql(int account_id, struct storage_data* p) /// Save guild_storage data to sql int inter_storage_guild_storage_tosql(int guild_id, struct guild_storage* p) { + nullpo_ret(p); chr->memitemdata_to_sql(p->items, MAX_GUILD_STORAGE, guild_id, TABLE_GUILD_STORAGE); ShowInfo ("guild storage save to DB - guild: %d\n", guild_id); return 0; @@ -95,6 +98,7 @@ int inter_storage_guild_storage_fromsql(int guild_id, struct guild_storage* p) int i; int j; + nullpo_ret(p); memset(p, 0, sizeof(struct guild_storage)); //clean up memory p->storage_amount = 0; p->guild_id = guild_id; @@ -297,7 +301,8 @@ int mapif_parse_ItemBoundRetrieve_sub(int fd) for( j = 0; j < MAX_SLOTS; ++j ) SQL->StmtBindColumn(stmt, 10+j, SQLDT_SHORT, &item.card[j], 0, NULL, NULL); - while( SQL_SUCCESS == SQL->StmtNextRow(stmt) ) { + while( SQL_SUCCESS == SQL->StmtNextRow(stmt)) { + Assert_retb(i < MAX_INVENTORY); memcpy(&items[i],&item,sizeof(struct item)); i++; } |