mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
Fix error when switching with no previous switches
This commit is contained in:
parent
90ceec61d9
commit
483611702e
1 changed files with 8 additions and 5 deletions
|
|
@ -143,12 +143,15 @@ 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);
|
||||||
var latestSwitchMembers = await _switches.GetSwitchMembers(latestSwitch);
|
if (latestSwitch != null)
|
||||||
|
{
|
||||||
|
var latestSwitchMembers = await _switches.GetSwitchMembers(latestSwitch);
|
||||||
|
|
||||||
|
// Bail if this switch is identical to the latest one
|
||||||
|
if (latestSwitchMembers.Select(m => m.Hid).SequenceEqual(param.Members))
|
||||||
|
return BadRequest("New members identical to existing fronters.");
|
||||||
|
}
|
||||||
|
|
||||||
// Bail if this switch is identical to the latest one
|
|
||||||
if (latestSwitchMembers.Select(m => m.Hid).SequenceEqual(param.Members))
|
|
||||||
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;
|
||||||
using (var conn = await _conn.Obtain())
|
using (var conn = await _conn.Obtain())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue