diff --git a/src/core/xfa/html_utils.js b/src/core/xfa/html_utils.js
index 2f850ab37..92897baac 100644
--- a/src/core/xfa/html_utils.js
+++ b/src/core/xfa/html_utils.js
@@ -238,7 +238,7 @@ function layoutNode(node, availableSpace) {
if (!font) {
const root = node[$getTemplateRoot]();
let parent = node[$getParent]();
- while (parent !== root) {
+ while (parent && parent !== root) {
if (parent.font) {
font = parent.font;
break;
diff --git a/test/pdfs/xfa_issue14150.pdf.link b/test/pdfs/xfa_issue14150.pdf.link
new file mode 100644
index 000000000..da6a4202e
--- /dev/null
+++ b/test/pdfs/xfa_issue14150.pdf.link
@@ -0,0 +1 @@
+https://github.com/mozilla/pdf.js/files/7528643/dol4n.pdf
diff --git a/test/test_manifest.json b/test/test_manifest.json
index a1e0f449b..8eea3d06d 100644
--- a/test/test_manifest.json
+++ b/test/test_manifest.json
@@ -1013,6 +1013,15 @@
"link": true,
"type": "load"
},
+ { "id": "xfa_issue14150",
+ "file": "pdfs/xfa_issue14150.pdf",
+ "md5": "295b3e513b62945fbba73bce6908344c",
+ "link": true,
+ "rounds": 1,
+ "enableXfa": true,
+ "lastPage": 1,
+ "type": "eq"
+ },
{ "id": "xfa_issue14071",
"file": "pdfs/xfa_issue14071.pdf",
"md5": "7ef09705091602668ce22086c83a90f3",