From 548db4a6a3cf7d2a307d911ed65d7f5985603d77 Mon Sep 17 00:00:00 2001 From: killerwife Date: Wed, 9 Oct 2024 22:18:42 +0200 Subject: [PATCH] Fix some bugs due to recent additions and certain options (#864) --- WowPacketParser/Parsing/Parsers/UpdateHandler.cs | 2 +- .../LegacyImplementation/UpdateFieldExtensions.cs | 5 ++++- WowPacketParserModule.V5_3_0_16981/Parsers/UpdateHandler.cs | 2 +- WowPacketParserModule.V5_4_0_17359/Parsers/UpdateHandler.cs | 2 +- WowPacketParserModule.V5_4_2_17658/Parsers/UpdateHandler.cs | 2 +- WowPacketParserModule.V5_4_7_17898/Parsers/UpdateHandler.cs | 2 +- WowPacketParserModule.V5_4_8_18291/Parsers/UpdateHandler.cs | 2 +- 7 files changed, 10 insertions(+), 7 deletions(-) diff --git a/WowPacketParser/Parsing/Parsers/UpdateHandler.cs b/WowPacketParser/Parsing/Parsers/UpdateHandler.cs index e2942770db..c7f0ad5f45 100644 --- a/WowPacketParser/Parsing/Parsers/UpdateHandler.cs +++ b/WowPacketParser/Parsing/Parsers/UpdateHandler.cs @@ -3104,7 +3104,7 @@ public static void HandleDestroyObject(Packet packet) update.Destroyed.Add(new DestroyedObject() { Guid = guid, - Text = packet.Writer.ToString() + Text = packet.Writer?.ToString() ?? "" }); } diff --git a/WowPacketParser/Store/Objects/UpdateFields/LegacyImplementation/UpdateFieldExtensions.cs b/WowPacketParser/Store/Objects/UpdateFields/LegacyImplementation/UpdateFieldExtensions.cs index 9407808f28..67cb1cbcab 100644 --- a/WowPacketParser/Store/Objects/UpdateFields/LegacyImplementation/UpdateFieldExtensions.cs +++ b/WowPacketParser/Store/Objects/UpdateFields/LegacyImplementation/UpdateFieldExtensions.cs @@ -118,7 +118,10 @@ public static TK[] GetArray(this Dictionary dict, T fir for (var i = 0; i < count; i++) { UpdateField uf; - if (dict.TryGetValue(Enums.Version.UpdateFields.GetUpdateField(firstUpdateField) + i, out uf)) + var updateField = Enums.Version.UpdateFields.GetUpdateField(firstUpdateField); + if (updateField == -1) + continue; + if (dict.TryGetValue(updateField + i, out uf)) { switch (type) { diff --git a/WowPacketParserModule.V5_3_0_16981/Parsers/UpdateHandler.cs b/WowPacketParserModule.V5_3_0_16981/Parsers/UpdateHandler.cs index b7e6ff3064..975f6ab452 100644 --- a/WowPacketParserModule.V5_3_0_16981/Parsers/UpdateHandler.cs +++ b/WowPacketParserModule.V5_3_0_16981/Parsers/UpdateHandler.cs @@ -873,7 +873,7 @@ public static void HandleDestroyObject(Packet packet) update.Destroyed.Add(new DestroyedObject() { Guid = destroyed, - Text = packet.Writer.ToString() + Text = packet.Writer?.ToString() ?? "" }); } } diff --git a/WowPacketParserModule.V5_4_0_17359/Parsers/UpdateHandler.cs b/WowPacketParserModule.V5_4_0_17359/Parsers/UpdateHandler.cs index 6bc037eba5..2366a0a4bf 100644 --- a/WowPacketParserModule.V5_4_0_17359/Parsers/UpdateHandler.cs +++ b/WowPacketParserModule.V5_4_0_17359/Parsers/UpdateHandler.cs @@ -883,7 +883,7 @@ public static void HandleDestroyObject(Packet packet) update.Destroyed.Add(new DestroyedObject() { Guid = destroyed, - Text = packet.Writer.ToString() + Text = packet.Writer?.ToString() ?? "" }); } } diff --git a/WowPacketParserModule.V5_4_2_17658/Parsers/UpdateHandler.cs b/WowPacketParserModule.V5_4_2_17658/Parsers/UpdateHandler.cs index a511eae482..aac0e7bbf7 100644 --- a/WowPacketParserModule.V5_4_2_17658/Parsers/UpdateHandler.cs +++ b/WowPacketParserModule.V5_4_2_17658/Parsers/UpdateHandler.cs @@ -918,7 +918,7 @@ public static void HandleDestroyObject(Packet packet) update.Destroyed.Add(new DestroyedObject() { Guid = destroyed, - Text = packet.Writer.ToString() + Text = packet.Writer?.ToString() ?? "" }); } diff --git a/WowPacketParserModule.V5_4_7_17898/Parsers/UpdateHandler.cs b/WowPacketParserModule.V5_4_7_17898/Parsers/UpdateHandler.cs index 0d4c3fe71e..d30c8a6744 100644 --- a/WowPacketParserModule.V5_4_7_17898/Parsers/UpdateHandler.cs +++ b/WowPacketParserModule.V5_4_7_17898/Parsers/UpdateHandler.cs @@ -37,7 +37,7 @@ public static void HandleDestroyObject(Packet packet) update.Destroyed.Add(new DestroyedObject() { Guid = destroyed, - Text = packet.Writer.ToString() + Text = packet.Writer?.ToString() ?? "" }); } diff --git a/WowPacketParserModule.V5_4_8_18291/Parsers/UpdateHandler.cs b/WowPacketParserModule.V5_4_8_18291/Parsers/UpdateHandler.cs index 62606ef99c..cfd44449cf 100644 --- a/WowPacketParserModule.V5_4_8_18291/Parsers/UpdateHandler.cs +++ b/WowPacketParserModule.V5_4_8_18291/Parsers/UpdateHandler.cs @@ -37,7 +37,7 @@ public static void HandleDestroyObject(Packet packet) update.Destroyed.Add(new DestroyedObject() { Guid = destroyed, - Text = packet.Writer.ToString() + Text = packet.Writer?.ToString() ?? "" }); }