diff --git a/src/Tgstation.Server.Host/Components/Chat/Commands/PullRequestsCommand.cs b/src/Tgstation.Server.Host/Components/Chat/Commands/PullRequestsCommand.cs index c4022d95d7..3fd8c9e64b 100644 --- a/src/Tgstation.Server.Host/Components/Chat/Commands/PullRequestsCommand.cs +++ b/src/Tgstation.Server.Host/Components/Chat/Commands/PullRequestsCommand.cs @@ -117,8 +117,8 @@ namespace Tgstation.Server.Host.Components.Chat.Commands async db => results = await db .RevisionInformations .AsQueryable() - .Where(x => x.Instance.Id == instance.Id && x.CommitSha == head) - .SelectMany(x => x.ActiveTestMerges) + .Where(x => x.Instance!.Id == instance.Id && x.CommitSha == head) + .SelectMany(x => x.ActiveTestMerges!) .Select(x => x.TestMerge) .Select(x => new Models.TestMerge { @@ -144,7 +144,7 @@ namespace Tgstation.Server.Host.Components.Chat.Commands compileJobToUse = null; } - results = compileJobToUse?.RevisionInformation.ActiveTestMerges.Select(x => x.TestMerge).ToList() ?? Enumerable.Empty(); + results = compileJobToUse?.RevisionInformation.ActiveTestMerges?.Select(x => x.TestMerge).ToList() ?? Enumerable.Empty(); } return new MessageContent diff --git a/src/Tgstation.Server.Host/Models/RevisionInformation.cs b/src/Tgstation.Server.Host/Models/RevisionInformation.cs index 8813e4c5bc..cbc8b82ad7 100644 --- a/src/Tgstation.Server.Host/Models/RevisionInformation.cs +++ b/src/Tgstation.Server.Host/Models/RevisionInformation.cs @@ -1,9 +1,8 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; -#nullable disable - namespace Tgstation.Server.Host.Models { /// @@ -23,22 +22,22 @@ namespace Tgstation.Server.Host.Models /// The the belongs to. /// [Required] - public Instance Instance { get; set; } + public Instance? Instance { get; set; } /// /// See . /// - public TestMerge PrimaryTestMerge { get; set; } + public TestMerge? PrimaryTestMerge { get; set; } /// /// See . /// - public ICollection ActiveTestMerges { get; set; } + public ICollection? ActiveTestMerges { get; set; } /// /// See s made from this . /// - public ICollection CompileJobs { get; set; } + public ICollection? CompileJobs { get; set; } /// public Api.Models.RevisionInformation ToApi() => new Api.Models.RevisionInformation @@ -47,8 +46,8 @@ namespace Tgstation.Server.Host.Models Timestamp = Timestamp, OriginCommitSha = OriginCommitSha, PrimaryTestMerge = PrimaryTestMerge?.ToApi(), - ActiveTestMerges = ActiveTestMerges.Select(x => x.TestMerge.ToApi()).ToList(), - CompileJobs = CompileJobs.Select(x => new Api.Models.EntityId + ActiveTestMerges = (ActiveTestMerges ?? throw new InvalidOperationException("ActiveTestMerges must be set!")).Select(x => x.TestMerge.ToApi()).ToList(), + CompileJobs = (CompileJobs ?? throw new InvalidOperationException("CompileJobs must be set!")).Select(x => new Api.Models.EntityId { Id = x.Id, }).ToList(),