diff --git a/Shoko.Server/API/v3/Models/Shoko/Group.cs b/Shoko.Server/API/v3/Models/Shoko/Group.cs
index 7aef64e40..79b9215be 100644
--- a/Shoko.Server/API/v3/Models/Shoko/Group.cs
+++ b/Shoko.Server/API/v3/Models/Shoko/Group.cs
@@ -158,7 +158,7 @@ public class CreateOrUpdateGroupBody
///
/// All the series to put into the group.
///
- public List SeriesIDs { get; set; } = new();
+ public List? SeriesIDs { get; set; } = new();
///
/// All groups to put into the group as sub-groups.
@@ -167,7 +167,7 @@ public class CreateOrUpdateGroupBody
/// If the parent group is a sub-group of any of the groups in this
/// array, then the request will be aborted.
///
- public List GroupIDs { get; set; } = new();
+ public List? GroupIDs { get; set; } = new();
///
/// The group's custom name.
@@ -256,26 +256,26 @@ public CreateOrUpdateGroupBody(SVR_AnimeGroup group)
}
// Get the groups and validate the group ids.
- var childGroups = GroupIDs
+ var childGroups = GroupIDs == null ? new() : GroupIDs
.Select(groupID => RepoFactory.AnimeGroup.GetByID(groupID))
.Where(childGroup => childGroup != null)
.ToList();
- if (childGroups.Count != GroupIDs.Count)
+ if (childGroups.Count != (GroupIDs?.Count ?? 0))
{
- var unknownGroupIDs = GroupIDs
+ var unknownGroupIDs = GroupIDs!
.Where(id => !childGroups.Any(childGroup => childGroup.AnimeGroupID == id))
.ToList();
modelState.AddModelError(nameof(GroupIDs), $"Unable to get child groups with ids \"{string.Join("\", \"", unknownGroupIDs)}\".");
}
// Get the series and validate the series ids.
- var seriesList = SeriesIDs
+ var seriesList = SeriesIDs == null ? new() : SeriesIDs
.Select(id => RepoFactory.AnimeSeries.GetByID(id))
.Where(s => s != null)
.ToList();
- if (seriesList.Count != SeriesIDs.Count)
+ if (seriesList.Count != (SeriesIDs?.Count ?? 0))
{
- var unknownSeriesIDs = SeriesIDs
+ var unknownSeriesIDs = SeriesIDs!
.Where(id => !seriesList.Any(series => series.AnimeSeriesID == id))
.ToList();
modelState.AddModelError(nameof(SeriesIDs), $"Unable to get series with ids \"{string.Join("\", \"", unknownSeriesIDs)}\".");