Remove double dict access when adding object property

This commit is contained in:
Jarrod Doyle 2024-10-27 08:39:17 +00:00
parent 466b7a4c0b
commit ef95b07926
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 4 additions and 3 deletions

View File

@ -79,11 +79,12 @@ public class ObjectHierarchy
foreach (var prop in chunk.properties) foreach (var prop in chunk.properties)
{ {
var id = prop.objectId; var id = prop.objectId;
if (!_objects.ContainsKey(id)) if (!_objects.TryGetValue(id, out var value))
{ {
_objects.Add(id, new DarkObject(id)); value = new DarkObject(id);
_objects.Add(id, value);
} }
_objects[id].properties.TryAdd(name, prop); value.properties.TryAdd(name, prop);
} }
} }