diff --git a/src/map/cashshop.c b/src/map/cashshop.c index 8f5f859dfe..6422d78d9c 100644 --- a/src/map/cashshop.c +++ b/src/map/cashshop.c @@ -316,7 +316,9 @@ bool sale_remove_item( uint16 nameid ){ int i; // Check if there is an entry for this item id - if( !sale_find_item(nameid, false) ){ + sale_item = sale_find_item(nameid, false); + + if( sale_item == NULL ){ return false; } @@ -326,22 +328,18 @@ bool sale_remove_item( uint16 nameid ){ return false; } - // Check if the sale is currently running - sale_item = sale_find_item(nameid, true); - - if( sale_item != NULL && sale_item->timer_end != INVALID_TIMER ){ - // Notify all clients that the sale has ended - clif_sale_end(sale_item, NULL, ALL_CLIENT); - } - if( sale_item->timer_start != INVALID_TIMER ){ delete_timer(sale_item->timer_start, sale_start_timer); sale_item->timer_start = INVALID_TIMER; } + // Check if the sale is currently running if( sale_item->timer_end != INVALID_TIMER ){ delete_timer(sale_item->timer_end, sale_end_timer); sale_item->timer_end = INVALID_TIMER; + + // Notify all clients that the sale has ended + clif_sale_end(sale_item, NULL, ALL_CLIENT); } // Find the original pointer in the array