Add null test before inserting in DoLayoutFlowedContainer()

The change at revision 3c90892 disallowed inserting null objects
into these linked lists which were previously silently tolerated,
so an explicit null check is required.

Bug: pdfium:1234
Change-Id: Iaa12a44be98b246da26a3399bf0b34beaf2da74b
Reviewed-on: https://pdfium-review.googlesource.com/c/50352
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/xfa/fxfa/layout/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/layout/cxfa_itemlayoutprocessor.cpp
index 324ad35..092f802 100644
--- a/xfa/fxfa/layout/cxfa_itemlayoutprocessor.cpp
+++ b/xfa/fxfa/layout/cxfa_itemlayoutprocessor.cpp
@@ -1718,7 +1718,8 @@
         if (!pLayoutNext->m_pNextSibling && m_pCurChildPreprocessor &&
             m_pCurChildPreprocessor->GetFormNode() ==
                 pLayoutNext->GetFormNode()) {
-          pLayoutNext->InsertAfter(m_pCurChildPreprocessor->m_pLayoutItem);
+          if (m_pCurChildPreprocessor->m_pLayoutItem)
+            pLayoutNext->InsertAfter(m_pCurChildPreprocessor->m_pLayoutItem);
           m_pCurChildPreprocessor->m_pLayoutItem = pLayoutNext;
           break;
         }