From 90b7239dcbb44439d5eed4129485bb6048ba977d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Aguilera=20Puerto?= Date: Mon, 19 Oct 2020 15:43:12 +0200 Subject: [PATCH] ConstructionPlacementHijack nullability fix --- .../Construction/ConstructionPlacementHijack.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Content.Client/Construction/ConstructionPlacementHijack.cs b/Content.Client/Construction/ConstructionPlacementHijack.cs index e84f3949fe..ed5003e8e9 100644 --- a/Content.Client/Construction/ConstructionPlacementHijack.cs +++ b/Content.Client/Construction/ConstructionPlacementHijack.cs @@ -1,4 +1,5 @@ -using Content.Client.GameObjects.Components.Construction; +#nullable enable +using Content.Client.GameObjects.Components.Construction; using Content.Client.GameObjects.EntitySystems; using Content.Shared.Construction; using Robust.Client.Placement; @@ -11,15 +12,15 @@ namespace Content.Client.Construction public sealed class ConstructionPlacementHijack : PlacementHijack { private readonly ConstructionSystem _constructionSystem; - private readonly ConstructionPrototype _prototype; + private readonly ConstructionPrototype? _prototype; public override bool CanRotate { get; } - public ConstructionPlacementHijack(ConstructionSystem constructionSystem, ConstructionPrototype prototype) + public ConstructionPlacementHijack(ConstructionSystem constructionSystem, ConstructionPrototype? prototype) { _constructionSystem = constructionSystem; _prototype = prototype; - CanRotate = prototype.CanRotate; + CanRotate = prototype?.CanRotate ?? true; } /// @@ -36,7 +37,7 @@ namespace Content.Client.Construction /// public override bool HijackDeletion(IEntity entity) { - if (entity.TryGetComponent(out ConstructionGhostComponent ghost)) + if (entity.TryGetComponent(out ConstructionGhostComponent? ghost)) { _constructionSystem.ClearGhost(ghost.GhostID); } @@ -48,7 +49,7 @@ namespace Content.Client.Construction { base.StartHijack(manager); - manager.CurrentBaseSprite = _prototype.Icon.DirFrame0(); + manager.CurrentBaseSprite = _prototype?.Icon.DirFrame0(); } } }