HandComponents now have a default hand, fixes crash

This commit is contained in:
Víctor Aguilera Puerto
2020-06-18 19:26:55 +02:00
parent 63acae7937
commit 5495f88583
2 changed files with 6 additions and 1 deletions

View File

@@ -59,7 +59,7 @@ namespace Content.Client.GameObjects
public IEntity GetEntity(string index)
{
if (_hands.TryGetValue(index, out var entity))
if (!string.IsNullOrEmpty(index) && _hands.TryGetValue(index, out var entity))
{
return entity;
}
@@ -166,6 +166,8 @@ namespace Content.Client.GameObjects
{
_hands.Add(slot, null);
}
serializer.DataField(this, x => ActiveIndex, "defaultHand", _hands.Keys.LastOrDefault());
}
public override void HandleMessage(ComponentMessage message, IComponent component)