Fix error when trying to change layer that doesn't exist in SpriteChange and SpriteStateChange.

This commit is contained in:
Víctor Aguilera Puerto
2020-10-12 12:54:41 +02:00
parent 99ba632afc
commit c904a7e9c4
2 changed files with 7 additions and 5 deletions

View File

@@ -1,4 +1,5 @@
#nullable enable
using System;
using System.Threading.Tasks;
using Content.Shared.Construction;
using JetBrains.Annotations;
@@ -27,6 +28,9 @@ namespace Content.Server.Construction.Completions
if (!entity.TryGetComponent(out SpriteComponent? sprite)) return;
// That layer doesn't exist, we do nothing.
if (sprite.LayerCount <= Layer) return;
sprite.LayerSetSprite(Layer, SpriteSpecifier);
}
}