mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Fix crash in trade status action (#1123)
* Fix crash in trade status action
This commit is contained in:
@@ -49,7 +49,7 @@ bool TradeStatusAction::Execute(Event event)
|
||||
uint32 status;
|
||||
p >> status;
|
||||
|
||||
if (status == TRADE_STATUS_TRADE_ACCEPT)
|
||||
if (status == TRADE_STATUS_TRADE_ACCEPT || (status == TRADE_STATUS_BACK_TO_TRADE && trader->GetTradeData() && trader->GetTradeData()->IsAccepted()))
|
||||
{
|
||||
WorldPacket p;
|
||||
uint32 status = 0;
|
||||
@@ -122,12 +122,13 @@ bool TradeStatusAction::Execute(Event event)
|
||||
|
||||
void TradeStatusAction::BeginTrade()
|
||||
{
|
||||
Player* trader = bot->GetTrader();
|
||||
if (!trader || GET_PLAYERBOT_AI(bot->GetTrader()))
|
||||
return;
|
||||
|
||||
WorldPacket p;
|
||||
bot->GetSession()->HandleBeginTradeOpcode(p);
|
||||
|
||||
if (GET_PLAYERBOT_AI(bot->GetTrader()))
|
||||
return;
|
||||
|
||||
ListItemsVisitor visitor;
|
||||
IterateItems(&visitor);
|
||||
|
||||
@@ -149,7 +150,7 @@ void TradeStatusAction::BeginTrade()
|
||||
bool TradeStatusAction::CheckTrade()
|
||||
{
|
||||
Player* trader = bot->GetTrader();
|
||||
if (!bot->GetTradeData() || !trader->GetTradeData())
|
||||
if (!bot->GetTradeData() || !trader || !trader->GetTradeData())
|
||||
return false;
|
||||
|
||||
if (!botAI->HasActivePlayerMaster() && GET_PLAYERBOT_AI(bot->GetTrader()))
|
||||
|
||||
Reference in New Issue
Block a user