diff --git a/Content.Server/GameObjects/EntitySystems/PointingSystem.cs b/Content.Server/GameObjects/EntitySystems/PointingSystem.cs index 301d55db95..26d34004f4 100644 --- a/Content.Server/GameObjects/EntitySystems/PointingSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/PointingSystem.cs @@ -3,12 +3,10 @@ using System; using System.Collections.Generic; using Content.Server.GameObjects.Components.Pointing; using Content.Server.Players; -using Content.Server.Utility; using Content.Shared.GameObjects.EntitySystems; using Content.Shared.Input; using Content.Shared.Interfaces; using JetBrains.Annotations; -using Microsoft.EntityFrameworkCore.Diagnostics; using Robust.Server.GameObjects.Components; using Robust.Server.Interfaces.Player; using Robust.Server.Player; @@ -84,7 +82,7 @@ namespace Content.Server.GameObjects.EntitySystems public bool TryPoint(ICommonSession? session, GridCoordinates coords, EntityUid uid) { - var player = (session as IPlayerSession)?.ContentData().Mind.CurrentEntity; + var player = (session as IPlayerSession)?.ContentData()?.Mind?.CurrentEntity; if (player == null) { return false; @@ -132,7 +130,7 @@ namespace Content.Server.GameObjects.EntitySystems if ((playerSession.VisibilityMask & layer) == 0) return false; - var ent = playerSession.ContentData().Mind.CurrentEntity; + var ent = playerSession.ContentData()?.Mind?.CurrentEntity; return ent != null && ent.Transform.MapPosition.InRange(player.Transform.MapPosition, PointingRange); diff --git a/Content.Server/Players/PlayerData.cs b/Content.Server/Players/PlayerData.cs index 8e54cf47f3..2ef562d5de 100644 --- a/Content.Server/Players/PlayerData.cs +++ b/Content.Server/Players/PlayerData.cs @@ -1,4 +1,5 @@ -using Content.Server.Mobs; +#nullable enable +using Content.Server.Mobs; using Robust.Server.Interfaces.Player; using Robust.Shared.Network; using Robust.Shared.ViewVariables; @@ -22,7 +23,7 @@ namespace Content.Server.Players /// DO NOT DIRECTLY SET THIS UNLESS YOU KNOW WHAT YOU'RE DOING. /// [ViewVariables] - public Mind Mind { get; set; } + public Mind? Mind { get; set; } public void WipeMind() { @@ -41,15 +42,15 @@ namespace Content.Server.Players /// /// Gets the correctly cast instance of content player data from an engine player data storage. /// - public static PlayerData ContentData(this IPlayerData data) + public static PlayerData? ContentData(this IPlayerData data) { - return (PlayerData)data.ContentDataUncast; + return (PlayerData?) data.ContentDataUncast; } /// /// Gets the correctly cast instance of content player data from an engine player data storage. /// - public static PlayerData ContentData(this IPlayerSession session) + public static PlayerData? ContentData(this IPlayerSession session) { return session.Data.ContentData(); }