Fix NPE in frontend

This commit is contained in:
Arne Keller 2021-08-29 15:59:42 +02:00
parent 29d692c231
commit 540f95c0f8

View File

@ -374,7 +374,8 @@ class MathjaxProofTree extends MathjaxAdapter {
const handleMouseEvent = (e: MouseEvent, mouseIn: boolean) => { const handleMouseEvent = (e: MouseEvent, mouseIn: boolean) => {
let typeTarget = e.target! as SVGGraphicsElement; let typeTarget = e.target! as SVGGraphicsElement;
let counter = 0; let counter = 0;
while (!typeTarget.classList.contains("typicalc-type") while (typeTarget.classList
&& !typeTarget.classList.contains("typicalc-type")
&& !typeTarget.classList.contains("typicalc-label")) { && !typeTarget.classList.contains("typicalc-label")) {
typeTarget = typeTarget.parentNode! as SVGGraphicsElement; typeTarget = typeTarget.parentNode! as SVGGraphicsElement;
counter++; counter++;
@ -382,6 +383,9 @@ class MathjaxProofTree extends MathjaxAdapter {
return; return;
} }
} }
if (!typeTarget.classList) {
return;
}
let isType = typeTarget.classList.contains("typicalc-type"); let isType = typeTarget.classList.contains("typicalc-type");
let isLabel = typeTarget.classList.contains("typicalc-label"); let isLabel = typeTarget.classList.contains("typicalc-label");
if (mouseIn) { if (mouseIn) {