Avoid DCHECK() failure in CXFA_Node::GetUIChildNode().

Bug: chromium:1286970
Change-Id: I751c863be631812688bc7c95f7d953d0ada3a92c
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/89650
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/testing/resources/pixel/xfa_specific/bug_1286970.in b/testing/resources/pixel/xfa_specific/bug_1286970.in
new file mode 100644
index 0000000..4454de7
--- /dev/null
+++ b/testing/resources/pixel/xfa_specific/bug_1286970.in
@@ -0,0 +1,31 @@
+{{header}}
+{{include ../../xfa_catalog_1_0.fragment}}
+{{include ../../xfa_object_2_0.fragment}}
+{{include ../../xfa_preamble_3_0.fragment}}
+{{include ../../xfa_config_4_0.fragment}}
+{{object 5 0}} <<
+  {{streamlen}}
+>>
+stream
+<template xmlns="http://www.xfa.org/schema/xfa-template/3.3/">
+  <subform layout="rl-tb" name="subform1">
+    <pageSet>
+      <pageArea name="Page1" id="Page1">
+        <contentArea x="18pt" y="18pt" w="72pt" h="72pt"/>
+        <medium stock="default" short="72pt" long="72pt"/>
+      </pageArea>
+    </pageSet>
+    <subformSet>
+      <subform><field h="73pt"></field></subform>
+    </subformSet>
+  </subform>
+</template>
+endstream
+endobj
+{{include ../../xfa_locale_6_0.fragment}}
+{{include ../../xfa_postamble_7_0.fragment}}
+{{include ../../xfa_pages_8_0.fragment}}
+{{xref}}
+{{trailer}}
+{{startxref}}
+%%EOF
diff --git a/testing/resources/pixel/xfa_specific/bug_1286970_expected.pdf.0.png b/testing/resources/pixel/xfa_specific/bug_1286970_expected.pdf.0.png
new file mode 100644
index 0000000..9b4c2d8
--- /dev/null
+++ b/testing/resources/pixel/xfa_specific/bug_1286970_expected.pdf.0.png
Binary files differ
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 53cbabf..ef043a5 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -3586,6 +3586,9 @@
 absl::optional<float> CXFA_Node::FindSplitPos(CXFA_FFDocView* pDocView,
                                               size_t szBlockIndex,
                                               float fCalcHeight) {
+  if (!HasCreatedUIWidget())
+    return absl::nullopt;
+
   if (GetFFWidgetType() == XFA_FFWidgetType::kSubform)
     return absl::nullopt;