From 1b5580386c4f50e1f9ac8980d4ecfef63e84f3f1 Mon Sep 17 00:00:00 2001 From: richie Date: Tue, 2 Jul 2019 16:17:03 +0800 Subject: [PATCH] NPE --- libs/submissions_process.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libs/submissions_process.js b/libs/submissions_process.js index 6d29fc8..b068d40 100644 --- a/libs/submissions_process.js +++ b/libs/submissions_process.js @@ -15,11 +15,13 @@ const getSubmissionInfo = (s, displayConfig) => ({ const getRoughResult = (x, displayConfig, roughOnly) => { let max = 0; - _.forEach(x.result.judge.subtasks, function (item) { - _.forEach(item.cases, function (one) { - max = Math.max(max, one.result.time); + if (x.result.judge) { + _.forEach(x.result.judge.subtasks, function (item) { + _.forEach(item.cases, function (one) { + max = Math.max(max, one.result.time); + }); }); - }); + } if (displayConfig.showResult) { if (x.pending) { let res = getCachedJudgeState(x.task_id) || null; @@ -38,7 +40,7 @@ const getRoughResult = (x, displayConfig, roughOnly) => { return { result: x.status, time: displayConfig.showUsage ? x.total_time : null, - maxItemTime: displayConfig.showUsage ? max : null, + maxItemTime: displayConfig.showUsage ? max === 0 ? x.total_time : max : null, memory: displayConfig.showUsage ? x.max_memory : null, score: displayConfig.showScore ? x.score : null };