diff --git a/Content.Server/Atmos/Serialization/TileAtmosCollectionSerializer.cs b/Content.Server/Atmos/Serialization/TileAtmosCollectionSerializer.cs index 71e4c2d0def..00be83e86d9 100644 --- a/Content.Server/Atmos/Serialization/TileAtmosCollectionSerializer.cs +++ b/Content.Server/Atmos/Serialization/TileAtmosCollectionSerializer.cs @@ -26,7 +26,7 @@ public Dictionary Read(ISerializationManager serializa { node.TryGetValue(new ValueDataNode("version"), out var versionNode); var version = ((ValueDataNode?) versionNode)?.AsInt() ?? 1; - Dictionary tiles; + Dictionary tiles = new(); // Backwards compatability if (version == 1) @@ -36,8 +36,6 @@ public Dictionary Read(ISerializationManager serializa var mixies = serializationManager.Read?>(tile2, hookCtx, context); var unique = serializationManager.Read?>(node["uniqueMixes"], hookCtx, context); - tiles = new Dictionary(); - if (unique != null && mixies != null) { foreach (var (indices, mix) in mixies) @@ -58,15 +56,14 @@ public Dictionary Read(ISerializationManager serializa else { var dataNode = (MappingDataNode) node["data"]; - var tileNode = (MappingDataNode) dataNode["tiles"]; var chunkSize = serializationManager.Read(dataNode["chunkSize"], hookCtx, context); - var unique = serializationManager.Read?>(dataNode["uniqueMixes"], hookCtx, context); - - tiles = new Dictionary(); + dataNode.TryGetValue(new ValueDataNode("uniqueMixes"), out var mixNode); + var unique = mixNode == null ? null : serializationManager.Read?>(mixNode, hookCtx, context); if (unique != null) { + var tileNode = (MappingDataNode) dataNode["tiles"]; foreach (var (chunkNode, valueNode) in tileNode) { var chunkOrigin = serializationManager.Read(chunkNode, hookCtx, context);