Fix error when switching with no previous switches
This commit is contained in:
parent
90ceec61d9
commit
483611702e
@ -143,11 +143,14 @@ namespace PluralKit.API.Controllers
|
|||||||
|
|
||||||
// We get the current switch, if it exists
|
// We get the current switch, if it exists
|
||||||
var latestSwitch = await _switches.GetLatestSwitch(_auth.CurrentSystem);
|
var latestSwitch = await _switches.GetLatestSwitch(_auth.CurrentSystem);
|
||||||
|
if (latestSwitch != null)
|
||||||
|
{
|
||||||
var latestSwitchMembers = await _switches.GetSwitchMembers(latestSwitch);
|
var latestSwitchMembers = await _switches.GetSwitchMembers(latestSwitch);
|
||||||
|
|
||||||
// Bail if this switch is identical to the latest one
|
// Bail if this switch is identical to the latest one
|
||||||
if (latestSwitchMembers.Select(m => m.Hid).SequenceEqual(param.Members))
|
if (latestSwitchMembers.Select(m => m.Hid).SequenceEqual(param.Members))
|
||||||
return BadRequest("New members identical to existing fronters.");
|
return BadRequest("New members identical to existing fronters.");
|
||||||
|
}
|
||||||
|
|
||||||
// Resolve member objects for all given IDs
|
// Resolve member objects for all given IDs
|
||||||
IEnumerable<PKMember> membersList;
|
IEnumerable<PKMember> membersList;
|
||||||
|
Loading…
Reference in New Issue
Block a user