Fix crash in trade status action (#1123)

* Fix crash in trade status action
This commit is contained in:
EricksOliveira
2025-03-28 12:08:05 -03:00
committed by GitHub
parent 50200584d1
commit d2204d41e2

View File

@@ -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()))