From 457f404245134d0a84d83d697111bf17fb68b0f4 Mon Sep 17 00:00:00 2001 From: ai4rei Date: Thu, 30 Dec 2010 17:23:54 +0000 Subject: * Fixed improper use of itemdb_search. It does not return NULL but a dummy item, if the item id is invalid. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14642 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/clif.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/map/clif.c') diff --git a/src/map/clif.c b/src/map/clif.c index b640780a9..36b72788d 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -12586,7 +12586,7 @@ void clif_Mail_read(struct map_session_data *sd, int mail_id) WFIFOL(fd,72) = 0; WFIFOL(fd,76) = msg->zeny; - if( item->nameid && (data = itemdb_search(item->nameid)) != NULL ) + if( item->nameid && (data = itemdb_exists(item->nameid)) != NULL ) { WFIFOL(fd,80) = item->amount; WFIFOW(fd,84) = (data->view_id)?data->view_id:item->nameid; @@ -12652,7 +12652,7 @@ void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) struct item_data *data; unsigned int weight; - if ((data = itemdb_search(sd->mail.inbox.msg[i].item.nameid)) == NULL) + if ((data = itemdb_exists(sd->mail.inbox.msg[i].item.nameid)) == NULL) return; switch( pc_checkadditem(sd, data->nameid, sd->mail.inbox.msg[i].item.amount) ) @@ -12865,7 +12865,7 @@ void clif_Auction_results(struct map_session_data *sd, short count, short pages, WFIFOL(fd,k) = auction.auction_id; safestrncpy((char*)WFIFOP(fd,4+k), auction.seller_name, NAME_LENGTH); - if( (item = itemdb_search(auction.item.nameid)) != NULL && item->view_id > 0 ) + if( (item = itemdb_exists(auction.item.nameid)) != NULL && item->view_id > 0 ) WFIFOW(fd,28+k) = item->view_id; else WFIFOW(fd,28+k) = auction.item.nameid; @@ -12926,7 +12926,7 @@ void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) return; } - if( (item = itemdb_search(sd->status.inventory[idx].nameid)) != NULL && !(item->type == IT_ARMOR || item->type == IT_PETARMOR || item->type == IT_WEAPON || item->type == IT_CARD || item->type == IT_ETC) ) + if( (item = itemdb_exists(sd->status.inventory[idx].nameid)) != NULL && !(item->type == IT_ARMOR || item->type == IT_PETARMOR || item->type == IT_WEAPON || item->type == IT_CARD || item->type == IT_ETC) ) { // Consumible or pets are not allowed clif_Auction_setitem(sd->fd, idx, true); return; @@ -13027,7 +13027,7 @@ void clif_parse_Auction_register(int fd, struct map_session_data *sd) return; } - if( (item = itemdb_search(sd->status.inventory[sd->auction.index].nameid)) == NULL ) + if( (item = itemdb_exists(sd->status.inventory[sd->auction.index].nameid)) == NULL ) { // Just in case clif_Auction_message(fd, 2); // The auction has been canceled return; -- cgit v1.2.3-70-g09d2