fix problems found by deepscan.io

This commit is contained in:
undefined committed 2020-11-08 23:44:16 +08:00
1 parent e8dcd97561
commit dd4ecdb029
13 files changed
+33 -29

No files matched your search

+1 -1
View File
@@ -323,8 +323,8 @@ export class ProblemPretestConnectionHandler extends ConnectionHandler {
@param('pid', Types.String)
async prepare(domainId: string, pid: string) {
const pdoc = await problem.get(domainId, pid);
if (pdoc.hidden) this.checkPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN);
if (!pdoc) throw new ProblemNotFoundError(domainId, pid);
if (pdoc.hidden) this.checkPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN);
this.pid = pdoc.docId.toString();
this.domainId = domainId;
this.dispose = bus.on('record/change', this.onRecordChange.bind(this));