Skip to content

Commit 6a77316

Browse files
committed
fix: can not sign in with empty organizations list
1 parent 439a15e commit 6a77316

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

GZCTF/Controllers/GameController.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ public async Task<IActionResult> JoinGame(int id, [FromBody] GameJoinModel model
134134
if (!string.IsNullOrEmpty(game.InviteCode) && game.InviteCode != model.InviteCode)
135135
return BadRequest(new RequestResponse("比赛邀请码错误"));
136136

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

140142
var user = await userManager.GetUserAsync(User);

0 commit comments

Comments
 (0)