From 9451babb764861cf0dbce720593cc2d812738f3b Mon Sep 17 00:00:00 2001 From: Slendy Date: Tue, 28 Mar 2023 14:32:49 -0500 Subject: [PATCH] Add null handling to SlotBase --- ProjectLighthouse/Types/Serialization/SlotBase.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ProjectLighthouse/Types/Serialization/SlotBase.cs b/ProjectLighthouse/Types/Serialization/SlotBase.cs index 233cee77..3c5edbaf 100644 --- a/ProjectLighthouse/Types/Serialization/SlotBase.cs +++ b/ProjectLighthouse/Types/Serialization/SlotBase.cs @@ -1,4 +1,5 @@ -using System.Xml.Serialization; +using System; +using System.Xml.Serialization; using LBPUnion.ProjectLighthouse.Types.Entities.Level; using LBPUnion.ProjectLighthouse.Types.Entities.Token; using LBPUnion.ProjectLighthouse.Types.Levels; @@ -50,6 +51,10 @@ public abstract class SlotBase : ILbpSerializable public static SlotBase CreateFromEntity(SlotEntity slot, GameVersion targetGame, int targetUserId) { + if (slot == null) + { + throw new Exception($"Tried to create GameSlot from null slot, targetGame={targetGame}, targetUserId={targetUserId}"); + } if (slot.Type == SlotType.Developer) { GameDeveloperSlot devSlot = new()