core: add null check

pull/150/head
undefined 3 years ago
parent 105608558f
commit d5e67de7ad

@ -2,4 +2,3 @@ dist
*.d.ts *.d.ts
node_modules node_modules
public public
packages/ui-default/

@ -1,6 +1,6 @@
{ {
"name": "hydrooj", "name": "hydrooj",
"version": "2.28.8", "version": "2.28.9",
"bin": "bin/hydrooj.js", "bin": "bin/hydrooj.js",
"main": "dist/loader.js", "main": "dist/loader.js",
"typings": "dist/loader.d.ts", "typings": "dist/loader.d.ts",

@ -247,7 +247,7 @@ export class ProblemModel {
const l = {}; const l = {};
const ddocs = await Promise.all(Object.keys(parsed).map((i) => domain.get(i))); const ddocs = await Promise.all(Object.keys(parsed).map((i) => domain.get(i)));
const f = ddocs.filter((i) => !( const f = ddocs.filter((i) => !(
i._id === domainId i?._id === domainId
|| i?.share === '*' || i?.share === '*'
|| (`,${(i?.share || '').replace(//g, ',').split(',').map((q) => q.trim()).join(',')},`).includes(`,${domainId},`) || (`,${(i?.share || '').replace(//g, ',').split(',').map((q) => q.trim()).join(',')},`).includes(`,${domainId},`)
)); ));

@ -111,15 +111,11 @@ export default class DOMAttachedObject {
} }
constructor($dom, monitorDetach = false) { constructor($dom, monitorDetach = false) {
if ($dom == null) { if ($dom == null) return null;
return null;
}
this.$dom = $dom; this.$dom = $dom;
this.id = ++DOMAttachedObject.uniqueIdCounter; this.id = ++DOMAttachedObject.uniqueIdCounter;
this.eventNS = `vj4obj_${this.id}`; this.eventNS = `vj4obj_${this.id}`;
this.detached = false; this.detached = false;
if (monitorDetach) { if (monitorDetach) monitorResource(this);
monitorResource(this);
}
} }
} }

Loading…
Cancel
Save