aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/Player
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2025-01-03 13:47:24 +0100
committerShauren <shauren.trinity@gmail.com>2025-01-03 13:47:24 +0100
commitc72de2fbbcdf5b416d78b9e455aced43517033a8 (patch)
tree37f5ae48e795aff0f5a01a772bad2ee3c024dd91 /src/server/game/Entities/Player
parent27860c3316b7354c6bf17cac82992085d2905934 (diff)
Core/Objects: Use span/array instead of vector for raw ObjectGuid manipulations
Diffstat (limited to 'src/server/game/Entities/Player')
-rw-r--r--src/server/game/Entities/Player/Player.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 4a0d9ec36bb..99197864561 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -18733,8 +18733,17 @@ void Player::_LoadAuras(PreparedQueryResult auraResult, PreparedQueryResult effe
uint32 effectIndex = fields[4].GetUInt8();
if (effectIndex < MAX_SPELL_EFFECTS)
{
- casterGuid.SetRawValue(fields[0].GetBinary());
- itemGuid.SetRawValue(fields[1].GetBinary());
+ std::span<uint8 const> rawGuidBytes = fields[0].GetBinaryView();
+ if (rawGuidBytes.size() != ObjectGuid::BytesSize)
+ continue;
+
+ casterGuid.SetRawValue(rawGuidBytes);
+
+ rawGuidBytes = fields[1].GetBinaryView();
+ if (rawGuidBytes.size() != ObjectGuid::BytesSize)
+ continue;
+
+ itemGuid.SetRawValue(rawGuidBytes);
AuraKey key{ casterGuid, itemGuid, fields[2].GetUInt32(), fields[3].GetUInt32() };
AuraLoadEffectInfo& info = effectInfo[key];
info.Amounts[effectIndex] = fields[5].GetInt32();
@@ -18753,8 +18762,17 @@ void Player::_LoadAuras(PreparedQueryResult auraResult, PreparedQueryResult effe
do
{
Field* fields = auraResult->Fetch();
- casterGuid.SetRawValue(fields[0].GetBinary());
- itemGuid.SetRawValue(fields[1].GetBinary());
+ std::span<uint8 const> rawGuidBytes = fields[0].GetBinaryView();
+ if (rawGuidBytes.size() != ObjectGuid::BytesSize)
+ continue;
+
+ casterGuid.SetRawValue(rawGuidBytes);
+
+ rawGuidBytes = fields[1].GetBinaryView();
+ if (rawGuidBytes.size() != ObjectGuid::BytesSize)
+ continue;
+
+ itemGuid.SetRawValue(rawGuidBytes);
AuraKey key{ casterGuid, itemGuid, fields[2].GetUInt32(), fields[3].GetUInt32() };
uint32 recalculateMask = fields[4].GetUInt32();
Difficulty difficulty = Difficulty(fields[5].GetUInt8());