From fb9f8cadf5ebe6c6d2fce3106a917cbd8956695d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 30 Mar 2015 16:51:12 +0300 Subject: Add checks to int_auction.c --- src/char/int_auction.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/char') diff --git a/src/char/int_auction.c b/src/char/int_auction.c index 57eae641d..2c54db16b 100644 --- a/src/char/int_auction.c +++ b/src/char/int_auction.c @@ -17,6 +17,7 @@ #include "../common/db.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" @@ -33,7 +34,7 @@ static int inter_auction_count(int char_id, bool buy) for( auction = dbi_first(iter); dbi_exists(iter); auction = dbi_next(iter) ) { - if( (buy && auction->buyer_id == char_id) || (!buy && auction->seller_id == char_id) ) + if ((buy && auction->buyer_id == char_id) || (!buy && auction->seller_id == char_id)) i++; } dbi_destroy(iter); @@ -160,6 +161,7 @@ static int inter_auction_end_timer(int tid, int64 tick, int id, intptr_t data) { void inter_auction_delete(struct auction_data *auction) { + nullpo_retv(auction); unsigned int auction_id = auction->auction_id; if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `auction_id` = '%d'", auction_db, auction_id) ) @@ -240,6 +242,8 @@ void mapif_auction_sendlist(int fd, int char_id, short count, short pages, unsig { int len = (sizeof(struct auction_data) * count) + 12; + nullpo_retv(buf); + WFIFOHEAD(fd, len); WFIFOW(fd,0) = 0x3850; WFIFOW(fd,2) = len; @@ -297,6 +301,8 @@ void mapif_auction_register(int fd, struct auction_data *auction) { int len = sizeof(struct auction_data) + 4; + nullpo_retv(auction); + WFIFOHEAD(fd,len); WFIFOW(fd,0) = 0x3851; WFIFOW(fd,2) = len; -- cgit v1.2.3-60-g2f50