Fixed client crashing when destroying certain entities.

This commit is contained in:
Pieter-Jan Briers
2019-10-22 00:00:17 +02:00
parent 738fbdd376
commit 9ac0e02574

View File

@@ -79,9 +79,17 @@ namespace Content.Client.GameObjects.EntitySystems
weaponArcAnimation.SetData(weaponArc, msg.Angle);
foreach (var hitEntity in msg.Hits.Select(u => EntityManager.GetEntity(u)))
foreach (var uid in msg.Hits)
{
if (!hitEntity.TryGetComponent(out ISpriteComponent sprite)) continue;
if (!EntityManager.TryGetEntity(uid, out var hitEntity))
{
continue;
}
if (!hitEntity.TryGetComponent(out ISpriteComponent sprite))
{
continue;
}
var originalColor = sprite.Color;
var newColor = Color.Red * originalColor;