Skip to content

Commit

Permalink
fix: can not sign in with empty organizations list
Browse files Browse the repository at this point in the history
  • Loading branch information
GZTimeWalker committed Sep 8, 2022
1 parent 439a15e commit 6a77316
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion GZCTF/Controllers/GameController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ public async Task<IActionResult> JoinGame(int id, [FromBody] GameJoinModel model
if (!string.IsNullOrEmpty(game.InviteCode) && game.InviteCode != model.InviteCode)
return BadRequest(new RequestResponse("比赛邀请码错误"));

if (game.Organizations is not null && !game.Organizations.Any(o => o == model.Organization))
if (game.Organizations is not null
&& game.Organizations.Count > 0
&& !game.Organizations.Any(o => o == model.Organization))
return BadRequest(new RequestResponse("无效的参赛单位"));

var user = await userManager.GetUserAsync(User);
Expand Down

0 comments on commit 6a77316

Please sign in to comment.