TrinityCore/TrinityCore — comment on commit 6a44399852f746883d39a17e34670e1f5c8c10a6
File:  line 0
By alexsot:

We need to update trade data only when trade is in progress
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 5ba80ca..585a31f 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -12884,12 +12884,15 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count)
AutoUnequipOffhandIfNeed();
}

- //! Update item count in trade window, prevent spoofing
+ //! Update item count in trade window if trade in progress, prevent spoofing
//! Since pSrcItem has its count updated (see above), Item::GetCount() will return the new count
//! in the underlying packet builder function
- TradeSlots const slot = GetTradeData()->GetTradeSlotForItem(pSrcItem->GetGUID());
- if (slot != TRADE_SLOT_INVALID)
- GetTradeData()->SetItem(slot, pSrcItem);
+ if (GetTradeData())
+ {
+ TradeSlots const slot = GetTradeData()->GetTradeSlotForItem(pSrcItem->GetGUID());
+ if (slot != TRADE_SLOT_INVALID)
+ GetTradeData()->SetItem(slot, pSrcItem);
+ }
}

void Player::SwapItem(uint16 src, uint16 dst)