From 540f95c0f86950588eded5290cf623ba95376e5d Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Sun, 29 Aug 2021 15:59:42 +0200 Subject: [PATCH] Fix NPE in frontend --- frontend/src/mathjax-proof-tree.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/mathjax-proof-tree.ts b/frontend/src/mathjax-proof-tree.ts index c215776..e1442bb 100644 --- a/frontend/src/mathjax-proof-tree.ts +++ b/frontend/src/mathjax-proof-tree.ts @@ -374,7 +374,8 @@ class MathjaxProofTree extends MathjaxAdapter { const handleMouseEvent = (e: MouseEvent, mouseIn: boolean) => { let typeTarget = e.target! as SVGGraphicsElement; let counter = 0; - while (!typeTarget.classList.contains("typicalc-type") + while (typeTarget.classList + && !typeTarget.classList.contains("typicalc-type") && !typeTarget.classList.contains("typicalc-label")) { typeTarget = typeTarget.parentNode! as SVGGraphicsElement; counter++; @@ -382,6 +383,9 @@ class MathjaxProofTree extends MathjaxAdapter { return; } } + if (!typeTarget.classList) { + return; + } let isType = typeTarget.classList.contains("typicalc-type"); let isLabel = typeTarget.classList.contains("typicalc-label"); if (mouseIn) {