diff --git a/Projects/Server/World/World.cs b/Projects/Server/World/World.cs index b777895dc..68db1eb45 100644 --- a/Projects/Server/World/World.cs +++ b/Projects/Server/World/World.cs @@ -329,15 +329,31 @@ namespace Server } bin.Read(buffer.AsSpan()); + string error; - t.Deserialize(br); - - if (br.Position != entry.Length) + try { - WriteConsoleLine($"***** Bad deserialize on {t.GetType()} *****"); - WriteConsoleLine( - $"Serialized object was {entry.Length} bytes, but {br.Position} bytes deserialized" - ); + t.Deserialize(br); + + error = br.Position != entry.Length + ? $"Serialized object was {entry.Length} bytes, but {br.Position} bytes deserialized" + : null; + } + catch (Exception e) + { + error = e.ToString(); + } + + if (error == null) + { + t.InitializeSaveBuffer(buffer); + } + else + { + Utility.PushColor(ConsoleColor.Red); + WriteConsoleLine($"***** Bad deserialize of {t.GetType()} *****"); + WriteConsoleLine(error); + Utility.PopColor(); WriteConsoleLine("Delete the object and continue? (y/n)"); @@ -347,10 +363,6 @@ namespace Server } t.Delete(); } - else - { - t.InitializeSaveBuffer(buffer); - } } }