Skip to content

Commit

Permalink
fix(excel): deal with Single exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
GZTimeWalker committed Apr 22, 2024
1 parent fe589ad commit 5947ee1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/GZCTF/Utils/ExcelHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ static void WriteBoardContent(ISheet sheet, ScoreboardModel scoreboard, int[] ch

foreach (var challId in challIds)
{
ChallengeItem chall = item.Challenges.Single(c => c.Id == challId);
row.CreateCell(colIndex++).SetCellValue(chall.Score);
ChallengeItem? chall = item.Challenges.SingleOrDefault(c => c.Id == challId);
row.CreateCell(colIndex++).SetCellValue(chall?.Score ?? 0);
}

rowIndex++;
Expand Down

0 comments on commit 5947ee1

Please sign in to comment.