Skip to content

Commit c0c63b1

Browse files
committed
Merge pull request #1475 from dpvc/issue1474
Avoid error when \overset or \underset is empty. Resolves issue #1474.
2 parents fd22363 + 56db9c0 commit c0c63b1

File tree

1 file changed

+8
-4
lines changed
  • unpacked/jax/output/PreviewHTML

1 file changed

+8
-4
lines changed

unpacked/jax/output/PreviewHTML/jax.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -767,8 +767,10 @@
767767
bbox = this.PHTMLbboxFor(this.base),
768768
BBOX = this.PHTML, acc = obox.acc;
769769
if (this.data[this.over]) {
770-
span.lastChild.firstChild.style.marginLeft = obox.l =
771-
span.lastChild.firstChild.style.marginRight = obox.r = 0;
770+
if (span.lastChild.firstChild){
771+
span.lastChild.firstChild.style.marginLeft = obox.l =
772+
span.lastChild.firstChild.style.marginRight = obox.r = 0;
773+
}
772774
var over = HTML.Element("span",{},[["span",{className:"MJXp-over"}]]);
773775
over.firstChild.appendChild(span.lastChild);
774776
if (span.childNodes.length > (this.data[this.under] ? 1 : 0))
@@ -786,8 +788,10 @@
786788
else {span.appendChild(over)}
787789
}
788790
if (this.data[this.under]) {
789-
span.lastChild.firstChild.style.marginLeft = ubox.l =
790-
span.lastChild.firstChild.marginRight = ubox.r = 0;
791+
if (span.lastChild.firstChild) {
792+
span.lastChild.firstChild.style.marginLeft = ubox.l =
793+
span.lastChild.firstChild.marginRight = ubox.r = 0;
794+
}
791795
this.data[this.under].PHTMLhandleScriptlevel(span.lastChild);
792796
}
793797
BBOX.w = Math.max(.8*obox.w,.8*ubox.w,bbox.w);

0 commit comments

Comments
 (0)