XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFESpaceNinjaServer

chore: handle missing ChallengeProgress entry in claimJunctionChallengeRewardController (#3183)

Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3183 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

e6211087
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

1 个文件 +4 -1
Modified src/controllers/api/claimJunctionChallengeRewardController.ts +4 -1
@@ -9,7 +9,10 @@ export const claimJunctionChallengeRewardController: RequestHandler = async (req
9 9 const accountId = await getAccountIdForRequest(req);
10 10 const inventory = await getInventory(accountId);
11 11 const data = getJSONfromString<IClaimJunctionChallengeRewardRequest>(String(req.body));
12 const challengeProgress = inventory.ChallengeProgress.find(x => x.Name == data.Challenge)!;
12 const challengeProgress = inventory.ChallengeProgress.find(x => x.Name == data.Challenge);
13 if (!challengeProgress) {
14 throw new Error(`attempt to claim challenge with no progress: ${String(req.body)}`);
15 }
13 16 if (challengeProgress.ReceivedJunctionReward) {
14 17 throw new Error(`attempt to double-claim junction reward`);
15 18 }