From 6fb9ba6f372f09604a512c30e9bafaec055e1cbc Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Sat, 4 Nov 2023 19:43:33 -0400 Subject: [PATCH] Check registered jobs have instance and user IDs --- src/Tgstation.Server.Host/Jobs/JobService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Tgstation.Server.Host/Jobs/JobService.cs b/src/Tgstation.Server.Host/Jobs/JobService.cs index 92d5096542..2212bba37d 100644 --- a/src/Tgstation.Server.Host/Jobs/JobService.cs +++ b/src/Tgstation.Server.Host/Jobs/JobService.cs @@ -120,7 +120,7 @@ namespace Tgstation.Server.Host.Jobs job.Instance = new Models.Instance { - Id = job.Instance.Id, + Id = job.Instance.Id ?? throw new InvalidOperationException("Instance associated with job does not have an Id!"), }; databaseContext.Instances.Attach(job.Instance); @@ -131,7 +131,7 @@ namespace Tgstation.Server.Host.Jobs else job.StartedBy = new User { - Id = job.StartedBy.Id, + Id = job.StartedBy.Id ?? throw new InvalidOperationException("StartedBy User associated with job does not have an Id!"), }; databaseContext.Users.Attach(job.StartedBy);