From b9215d214e282fdf9764583b692770bfb3044e22 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Mon, 8 Jul 2019 13:35:05 +0200 Subject: [PATCH] Fix ContainerSlot not serializing correctly when empty. --- Content.Server/GameObjects/ContainerSlot.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Content.Server/GameObjects/ContainerSlot.cs b/Content.Server/GameObjects/ContainerSlot.cs index 390342b523..939a409a25 100644 --- a/Content.Server/GameObjects/ContainerSlot.cs +++ b/Content.Server/GameObjects/ContainerSlot.cs @@ -1,4 +1,5 @@ -using Robust.Server.GameObjects.Components.Container; +using System; +using Robust.Server.GameObjects.Components.Container; using Robust.Server.Interfaces.GameObjects; using Robust.Shared.Interfaces.GameObjects; using System.Collections.Generic; @@ -12,7 +13,18 @@ namespace Content.Server.GameObjects public IEntity ContainedEntity { get; private set; } = null; /// - public override IReadOnlyCollection ContainedEntities => new List { ContainedEntity }.AsReadOnly(); + public override IReadOnlyCollection ContainedEntities + { + get + { + if (ContainedEntity == null) + { + return Array.Empty(); + } + + return new List {ContainedEntity}.AsReadOnly(); + } + } public ContainerSlot(string id, IContainerManager manager) : base(id, manager) {