From 2170cfc01ba04006c6e19f90e825d43ed83c8806 Mon Sep 17 00:00:00 2001 From: Lemongrass3110 Date: Tue, 3 May 2016 19:33:23 +0200 Subject: [PATCH] Fixed a cashshop crash after reloaditemdb Fixes #1234, thanks to @julia40124009. Please note that it is currently not supported to resend the cashshop data to the players. It is only transmitted once during login as per request from the client. --- src/map/cashshop.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/map/cashshop.c b/src/map/cashshop.c index b3ff7dc7cf..29711d74d3 100644 --- a/src/map/cashshop.c +++ b/src/map/cashshop.c @@ -188,9 +188,14 @@ bool cashshop_buylist( struct map_session_data* sd, uint32 kafrapoints, int n, u ARR_FIND( 0, cash_shop_items[tab].count, j, nameid == cash_shop_items[tab].item[j]->nameid || nameid == itemdb_viewid(cash_shop_items[tab].item[j]->nameid) ); + if( j == cash_shop_items[tab].count ){ + clif_cashshop_result( sd, nameid, CASHSHOP_RESULT_ERROR_UNKONWN_ITEM ); + return false; + } + nameid = *( item_list + i * 5 ) = cash_shop_items[tab].item[j]->nameid; //item_avail replacement - if( j == cash_shop_items[tab].count || !itemdb_exists( nameid ) ){ + if( !itemdb_exists( nameid ) ){ clif_cashshop_result( sd, nameid, CASHSHOP_RESULT_ERROR_UNKONWN_ITEM ); return false; }else if( !itemdb_isstackable( nameid ) && quantity > 1 ){